书签 分享 收藏 举报 版权申诉 / 21

类型jqgrid学习笔记.docx

  • 文档编号:28671810
  • 上传时间:2023-07-19
  • 格式:DOCX
  • 页数:21
  • 大小:22.35KB


void(0)"id="m1">GetSelectedid's

void(0)"id="m1s">Select(Unselect)row13

JavaScrptcode

...

jQuery("#list9").jqGrid({

url:

'server.php?

q=2&nd='+newDate().getTime(),

datatype:

"json",

colNames:

['InvNo','Date','Client','Amount','Tax','Total','Notes'],

colModel:

[

{name:

'id',index:

'id',width:

55},

{name:

'invdate',index:

'invdate',width:

90},

{name:

'name',index:

'name',width:

100},

{name:

'amount',index:

'amount',width:

80,align:

"right"},

{name:

'tax',index:

'tax',width:

80,align:

"right"},

{name:

'total',index:

'total',width:

80,align:

"right"},

{name:

'note',index:

'note',width:

150,sortable:

false}

],

rowNum:

10,

rowList:

[10,20,30],

pager:

'#pager9',

sortname:

'id',

recordpos:

'left',

viewrecords:

true,

sortorder:

"desc",

multiselect:

true,

caption:

"MultiSelectExample"

});

jQuery("#list9").jqGrid('navGrid','#pager9',{add:

false,del:

false,edit:

false,position:

'right'});

jQuery("#m1").click(function(){

vars;

s=jQuery("#list9").jqGrid('getGridParam','selarrrow');

alert(s);

});

jQuery("#m1s").click(function(){

jQuery("#list9").jqGrid('setSelection',"13");

});

 

HTML

...

InvoiceHeader


InvoiceDetail

void(0)"id="ms1">GetSelectedid's

JavaScrptcode

...

jQuery("#list10").jqGrid({

url:

'server.php?

q=2',

datatype:

"json",

colNames:

['InvNo','Date','Client','Amount','Tax','Total','Notes'],

colModel:

[

{name:

'id',index:

'id',width:

55},

{name:

'invdate',index:

'invdate',width:

90},

{name:

'name',index:

'name',width:

100},

{name:

'amount',index:

'amount',width:

80,align:

"right"},

{name:

'tax',index:

'tax',width:

80,align:

"right"},

{name:

'total',index:

'total',width:

80,align:

"right"},

{name:

'note',index:

'note',width:

150,sortable:

false}

],

rowNum:

10,

rowList:

[10,20,30],

pager:

'#pager10',

sortname:

'id',

viewrecords:

true,

sortorder:

"desc",

multiselect:

false,

caption:

"InvoiceHeader",

onSelectRow:

function(ids){

if(ids==null){

ids=0;

if(jQuery("#list10_d").jqGrid('getGridParam','records')>0)

{

jQuery("#list10_d").jqGrid('setGridParam',{url:

"subgrid.php?

q=1&id="+ids,page:

1});

jQuery("#list10_d").jqGrid('setCaption',"InvoiceDetail:

"+ids)

.trigger('reloadGrid');

}

}else{

jQuery("#list10_d").jqGrid('setGridParam',{url:

"subgrid.php?

q=1&id="+ids,page:

1});

jQuery("#list10_d").jqGrid('setCaption',"InvoiceDetail:

"+ids)

.trigger('reloadGrid');

}

}

});

jQuery("#list10").jqGrid('navGrid','#pager10',{add:

false,edit:

false,del:

false});

jQuery("#list10_d").jqGrid({

height:

100,

url:

'subgrid.php?

q=1&id=0',

datatype:

"json",

colNames:

['No','Item','Qty','Unit','LineTotal'],

colModel:

[

{name:

'num',index:

'num',width:

55},

{name:

'item',index:

'item',width:

180},

{name:

'qty',index:

'qty',width:

80,align:

"right"},

{name:

'unit',index:

'unit',width:

80,align:

"right"},

{name:

'linetotal',index:

'linetotal',width:

80,align:

"right",sortable:

false,search:

false}

],

rowNum:

5,

rowList:

[5,10,20],

pager:

'#pager10_d',

sortname:

'item',

viewrecords:

true,

sortorder:

"asc",

multiselect:

true,

caption:

"InvoiceDetail"

}).navGrid('#pager10_d',{add:

false,edit:

false,del:

false});

jQuery("#ms1").click(function(){

vars;

s=jQuery("#list10_d").jqGrid('getGridParam','selarrrow');

alert(s);

});

 

HTML

...

<

JavaScrptcode

...

jQuery("#list11").jqGrid({

url:

'server.php?

q=1',

datatype:

"xml",

height:

200,

colNames:

['InvNo','Date','Client','Amount','Tax','Total','Notes'],

colModel:

[

{name:

'id',index:

'id',width:

55},

{name:

'invdate',index:

'invdate',width:

90},

{name:

'name',index:

'name',width:

100},

{name:

'amount',index:

'amount',width:

80,align:

"right"},

{name:

'tax',index:

'tax',width:

80,align:

"right"},

{name:

'total',index:

'total',width:

80,align:

"right"},

{name:

'note',index:

'note',width:

150,sortable:

false}

],

rowNum:

10,

rowList:

[10,20,30],

pager:

'#pager11',

sortname:

'id',

viewrecords:

true,

sortorder:

"desc",

multiselect:

false,

subGrid:

true,

subGridUrl:

'subgrid.php?

q=2',

subGridModel:

[{name:

['No','Item','Qty','Unit','LineTotal'],

width:

[55,200,80,80,80]}

],

caption:

"SubgridExample"

});

jQuery("#list11").jqGrid('navGrid','#pager11',{add:

false,edit:

false,del:

false});

 

HTML

...

JavaScrptcode

jQuery("#listsg11").jqGrid({

url:

'server.php?

q=1',

datatype:

"xml",

height:

190,

colNames:

['InvNo','Date','Client','Amount','Tax','Total','Notes'],

colModel:

[

{name:

'id',index:

'id',width:

55},

{name:

'invdate',index:

'invdate',width:

90},

{name:

'name',index:

'name',width:

100},

{name:

'amount',index:

'amount',width:

80,align:

"right"},

{name:

'tax',index:

'tax',width:

80,align:

"right"},

{name:

'total',index:

'total',width:

80,align:

"right"},

{name:

'note',index:

'note',width:

150,sortable:

false}

],

rowNum:

8,

rowList:

[8,10,20,30],

pager:

'#pagersg11',

sortname:

'id',

viewrecords:

true,

sortorder:

"desc",

multiselect:

false,

subGrid:

true,

caption:

"GridasSubgrid",

subGridRowExpanded:

function(subgrid_id,row_id){

//wepasstwoparameters

//subgrid_idisaidofthedivtagcreatedwhitinatabledata

//theidofthiselemenetisacombinationofthe"sg_"+idoftherow

//therow_idistheidoftherow

举报
举报
版权申诉
版权申诉
word格式文档无特别注明外均可编辑修改;预览文档经过压缩,下载后原文更清晰! 立即下载
配套讲稿:

如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

特殊限制:

部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

关 键  词:
jqgrid 学习 笔记
提示  冰豆网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
关于本文
本文标题:jqgrid学习笔记.docx
链接地址:https://www.bdocx.com/doc/28671810.html
相关搜索
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2008-2022 冰点文档网站版权所有

经营许可证编号:鄂ICP备2022015515号-1

收起
展开