欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jqGrid jQuery 表格插件測(cè)試代碼

 更新時(shí)間:2011年08月23日 23:08:32   作者:  
在逛博客中無(wú)意中看到這個(gè)插件,一下就吸引住了我,于是就自己在網(wǎng)上找了些資料實(shí)踐了一下

官方Demo地址:http://www.trirand.com/blog/jqgrid/jqgrid.html

效果圖:

頁(yè)面代碼:

復(fù)制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>本地?cái)?shù)據(jù)</title>
<link href="css/redmond/jquery-ui-1.8.14.custom.css" rel="Stylesheet" />
<link href="css/ui.jqgrid.css" rel="Stylesheet" />
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.jqGrid.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#list1").jqGrid({
datatype:"local",
height:250,
colNames:['自動(dòng)編號(hào)','地區(qū)編號(hào)','地區(qū)名稱','所屬城市編號(hào)'],
colModel:[ //這一項(xiàng)比較重要, 其中的name屬性主要是用于后期的頁(yè)面代碼(注意這里的范圍是本頁(yè)面上的代碼,不會(huì)涉及到后臺(tái)代碼), 而index屬性是則是用于涉及后臺(tái)時(shí),給后臺(tái)傳遞排序字段
{name:'id',index:'id',width:60,sorttype:"int"},
{name:'areaID',index:'areaID',width:80,sortable:false}, //sortable是該字段是否排序
{name:'area',index:'area',width:180},
{name:'father',index:'father',width:100,sortable:false} //colModel兩個(gè)最主要就是1:name前臺(tái)js用,2:index給后臺(tái)傳遞排序字段
],
multiselect:true, //是否允許多選擇多項(xiàng)
caption:"中國(guó)各城市的主要地區(qū)" //表格的標(biāo)題文字
});
var mydata=[
{id:"1",areaID:'110101',area:'東城區(qū)',father:'110100'},
{id:"2",areaID:'110102',area:'西城區(qū)',father:'110100'},
{id:"3",areaID:'110103',area:'崇文區(qū)',father:'110100'},
{id:"4",areaID:'110104',area:'宣武區(qū)',father:'110100'},
{id:"5",areaID:'110105',area:'朝陽(yáng)區(qū)',father:'110100'},
{id:"6",areaID:'110106',area:'豐臺(tái)區(qū)',father:'110100'},
{id:"7",areaID:'110107',area:'石景山區(qū)',father:'110100'},
{id:"8",areaID:'110108',area:'海淀區(qū)',father:'110100'},
{id:"9",areaID:'110109',area:'門頭溝區(qū)',father:'110100'},
{id:"10",areaID:'110111',area:'房山區(qū)',father:'110100'}
];
for(var i=0; i<mydata.length; i++) //循環(huán)給每行添加數(shù)據(jù)
{
$("#list1").jqGrid('addRowData',i+1,mydata[i]);
}
});
</script>
</head>
<body>
<table id="list1"></table>
<div id="pager1"></div>
</body>
</html>

相關(guān)文章

最新評(píng)論