1
当我刚开始使用的jqGrid,但是当我尝试最简单的例子(加载JSON数据),它不工作(没有行加在TBODY)没有行添加使用的jqGrid JSON格式
我已经加载这些文件头部分
<link rel="stylesheet" type="text/css" href="http://192.168.3.9/wavinet2-permana/application/themes/default/css/jqueryui/jquery-ui-1.8.8.custom.css">
<script src="http://192.168.3.9/wavinet2-permana/application/themes/default/js/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="http://192.168.3.9/wavinet2-permana/application/themes/default/js/jquery-ui-1.8.8.custom.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/wavinet2-permana/application/assets/css/jqgrid/ui.jqgrid.css">
<script src="/wavinet2-permana/application/assets/js/jqgrid/i18n/grid.locale-id.js" type="text/javascript"></script>
<script src="/wavinet2-permana/application/assets/js/jqgrid/jquery.jqGrid.min.js" type="text/javascript"></script>
而且我的JavaScript加载和配置的jqGrid
<script type="text/javascript">
$('#list2').jqGrid({
url: SITE_URL+'/account/test/jqgrid_ajax',
dataType: 'json',
mtype: 'GET',
colNames: ['Username', 'Nama Person'],
colModel: [
{name:'username', index: 'username', width:200, key:true},
{name:'nama_person', index: 'nama_person', width:200}
],
rowNum: 10,
rowList: [10, 20, 30],
pager: '#pager2',
sortname: 'username',
sortorder: 'ASC',
caption: 'Account Example',
viewrecords: true,
jsonReader: {repeatitems: false}
});
$('#list2').jqGrid('navGrid','#pager2',{edit:false,add:false,del:false});
</script>
体
<table id="list2" width="100%"></table>
<div id="pager2"></div>
JSON响应
{
"page":"1",
"total":"2",
"records":"13",
"rows":[
{
"id":"Oke1",
"cell":[
"Oke1",
"Deh"
]
},
{
"id":"Oke2",
"cell":[
"Oke2",
"Deh"
]
},
{
"id":"Oke3",
"cell":[
"Oke3",
"Deh"
]
},
{
"id":"Oke4",
"cell":[
"Oke4",
"Deh"
]
},
{
"id":"Oke5",
"cell":[
"Oke5",
"Deh"
]
},
{
"id":"Oke6",
"cell":[
"Oke6",
"Deh"
]
},
{
"id":"Oke7",
"cell":[
"Oke7",
"Deh"
]
},
{
"id":"Oke8",
"cell":[
"Oke8",
"Deh"
]
},
{
"id":"Oke9",
"cell":[
"Oke9",
"Deh"
]
},
{
"id":"Oke10",
"cell":[
"Oke10",
"Deh"
]
}
]
}
我尝试在Firefox的Windows,Ubuntu的火狐和Internet Explorer 8中打开,它返回相同的结果。网格渲染但也有TBODY
感谢您创建演示页面。但是,什么是multiCol.js?因为我无法在jqgrid上找到我下载的文件 – Permana
@Permana:这是剪切和粘贴错误。您可以改为使用标准的'jquery.jqGrid.min.js'或'jquery.jqGrid.src.js'。我现在修复了演示。当时我只是想改变jqGrid的一些建议,以允许支持多个列标题(标题组),如[here](http://www.ok-soft-gmbh.com/jqGrid/SimpleLocalGridHeadersWithFirstRow4.htm)所述在[答案](http://stackoverflow.com/questions/7341339/jqgrid-column-group/7351638#7351638)。我只是忘了改变'jquery.jqGrid.src.js'的名字。 – Oleg
是的,它也工作没有jqGrid.src.multicol.js。谢谢 – Permana