I want to make grid with jquery.I read data from xml. when I run it on Chrome browser it works.But when I try it on IE it gives this error.
Grid can not be used in this ('quirks') mode!
I write this code:
var datasource_url = "/Data/XML_Data.xml";
function makeID(string) {
return string.toLowerCase().replace(/\s/g, "_")
}
$(function() {
$.loadGrid = function() {
$.ajax({
cache: false,
url :datasource_url ,
dataType: "xml",
success: function(data, res) {
var colNames = new Array;
var colIDs = new Array;
var colModel = new Array;
var datas = new Array;
var metadata = $(data).find("metadata").each(function() {
$(this).find('item').each(function() {
var colname = $(this).attr('name');
var colid = makeID($(this).attr('name'));
var coltype = $(this).attr('type');
var collength = $(this).attr('length');
var sorttype = null;
var sortable = false;
switch(coltype) {
case "xs:double":
sorttype = "float";
sortable = true;
break;
case "xs:string":
default:
sorttype = "text";
sortable = true;
break;
}
colNames[colNames.length] = colname;
colIDs[colIDs.length] = colid;
colModel[colModel.length] = {name: colid, index: colid, width: 200, align: "center", sorttype: sorttype, sortable: sortable}
});
});
var options = {
datatype: "local",
height: 500,
colNames: colNames,
colModel: colModel,
multiselect: false,
caption : "Data Grid",
rowNum : 1000,
rownumbers: true
}
$("#datagrid").jqGrid(options);
$(data).find("data").each(function() {
var i=0;
$(this).find('row').each(function() {
var idx = 0;
var rowdata = new Object;
$(this).find('value').each(function() {
var ccolid = colIDs[idx];
if (ccolid) {
rowdata[ccolid] = $(this).text();
}
idx++;
})
$("#datagrid").jqGrid('addRowData', i+1, rowdata)
i++
})
})
}
})
}
$.loadGrid();
/*
$("#btnLoadGrid").click(function() {
//$(this).attr("disabled", "disabled")
$.loadGrid();
})
*/
});
</script>
How can I fix this.
<!DOCTYPE html>
=> it's also a lot easier to remember) – Indulgence<!-- DOCTYPE HTML PUBLIC... -->
thing atm, that's where you should write<!DOCTYPE html>
, that should prevent IE from kicking into quirk mode. Let me know if it worked, I'll add it as answer, then – Indulgence