官方Demo 위치:http://www.trirand.com/blog/jqgrid/jqgrid.html 效果图: 页面代码: 复代码 代码如下: <머리> 本地数据 <br>$(document).ready(function(){ <br>$("#list1").jqGrid({ <br>datatype:"local", <br>height:250, <br>colNames:[ '自动编号','地区编号','地区name称','所属citycity编号'], <br>colModel:[ //这一项比较重要, 其中的name属性主要是用于后期的页face代码( 감사합니다这里的范围是本页side上的代码,不会涉及到后台代码), 而index属性是则是用于涉及后台时,给后台传递排序字段 <br>{name :'id',색인:'id' ,width:60,sorttype:"int"}, <br>{name:'areaID',index:'areaID',width:80,sortable:false}, //정렬 가능是该字段是否排序 <br>{name :'area',index:'area',width:180}, <br>{name:'father',index:'father',width:100,sortable:false} //colModel两个最主要就是1: name前台js 사용,2:index给后台传递排序字段 <br>], <br>multiselect:true, //是否允许多选择多项 <br>caption:"中國各城市主要地区" //表格的标题文字 <br>}) <br>var mydata=[ <br>{id:"1",areaID:'110101',area:'东城区',father:'110100'}, <br>{id :"2",areaID:'110102',area:'西城区',father:'110100'}, <br>{id:"3",areaID:'110103',area:'崇文区',father: '110100'}, <br>{id:"4",areaID:'110104',area:'宣武区',father:'110100'}, <br>{id:"5",areaID:'110105' ,area:'朝阳区',father:'110100'}, <br>{id:"6",areaID:'110106',area:'丰台区',father:'110100'}, <br>{id :"7",areaID:'110107',지역:'석景山区',아버지:'110100'}, <br>{id:"8",areaID:'110108',지역:'海淀区',아버지: '110100'}, <br>{id:"9",areaID:'110109',area:'门头沟区',father:'110100'}, <br>{id:"10",areaID:'110111' ,지역:'房山区',아버지:'110100'} <br>]; <br>for(var i=0; i<mydata.length; i ) //循环给每行添加数据 <br>{ <br>$("#list1").jqGrid('addRowData',i 1, 내데이터[i]); <br>} <br>}); <br> <본문>