I cannot determine what is the cause of why the data is not displayed in jqGrid when using IE 9 and 8. This is how I initialize my grid and give it data:
$(function(){
$("#userlist").jqGrid({
//data: {},
datatype : "local",
jsonReader : {
repeatitems : false,
id : "id"
},
colNames:[
'',
'NAme',
'Address',
],
colModel:[
{name:'id',index:'id', hidden:true},
{name:'name',index:'name', width:300},
{name:'add',index:'add', hidden:true},
],
autowidth: true,
sortname: 'id',
multiselect: true,
multiboxonly: true,
rowList:[10,50,100],
rowNum:10,
height:250,
pager: '#userlist',
viewrecords: true,
});
loadData();
});
function loadData(){
var obj = getObjSomewhere();
.
.
.
console.log(obj.users.length);
//obj.users -> array of objects for jqgrid
if(obj.users != undefined){
var ugrid = $("#userlist");
ugrid.clearGridData();
ugrid.setGridParam({data: obj.users, datatype : 'local'});
ugrid.trigger("reloadGrid");
}
}
It works on other browsers, and I cant find any errors in the console. Also, I checked that the obj.users has data. However, I have a function that adds users to that grid. When I do the adding of users, the newly added user will be displayed. It is only on the initial load that the existing users will not be displayed.
I suppose that it's well-known problem in jqGrid 4.7. I recommend you download the latest version of free jqGrid (post 4.8) from GitHub . It contains fixes and performance improvements. You can read more about free jqGrid in readme and wiki . You try the code first of all using RawGit service and including URLs which load the files direct from GitHub https://rawgit.com/free-jqgrid/jqGrid/master/css/ui.jqgrid.css
, https://rawgit.com/free-jqgrid/jqGrid/master/js/i18n/grid.locale-en.js
, https://rawgit.com/free-jqgrid/jqGrid/master/js/jquery.jqgrid.min.js
(see the part of wiki ). Alternatively you can use old version of jqGrid: version 4.6.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.