The code for the above DataGrid corresponds to the following:
1$ (' #tbCheckOut '). DataGrid ({2Title: ' Waiting to be allocated location ',3Iconcls: ' Icon-search ',4width:1112,5height:500,6Rownumbers:true,7IDfield: ' ID ',8SortOrder: ' desc ',9Sortname: ' ID ',TenRemotesort:false, OneNoWrapfalse, ACollapsible:true, -Striped:true, -Fitcolumns:false, thePagesize:10, -Pagination:true, -URL: '/stockout/webajax/proccheckoutlist.ashx ', -Queryparams:convertarray ($ (' #fmSearch '). Serializearray ()), +Onloadsuccess:function(data) { -$ (' #tbCheckOut '). DataGrid (' Collapsegroup ');//set Collapse + }, AOndblclickcell:function(Index, field, value) { at }, - columns: [[ -{field: ' Singlechk ', width:50, checkbox:true}, -{field: ' Checkouttype ', title: ' Document Type ', width:80, align: ' center ', sortable:true, Formatter:function(value, row) { - returnFgetcheckouttypeinfo (value); - } in }, -{field: ' Posttime ', title: ' Order Date ', width:70, align: ' center ', sortable:true, Formatter:function(value, row) { to returnChangeshortdateformat (value); + } - }, the{field: ' K3ordercode ', title: ' Number ', width:120, align: ' center ', sortable:true }, *{field: ' Serialno ', title: ' Serial number ', width:120, align: ' center ', sortable:true }, ${field: ' Customname ', title: ' Customer ', width:200, align: ' center ', sortable:true, Formatter:function(value, row) {Panax Notoginseng varRtnstr = value;//Todo Intercept - returnRtnstr; the } + }, A{field: ' Itemsncode ', title: ' Material code ', width:120, align: ' center ', sortable:true }, the{field: ' Skucode ', title: ' SKU ', width:50, align: ' center ', sortable:true }, +{field: ' Itemsnname ', title: ' Material name ', width:250, align: ' center ', sortable:true }, -{field: ' Assignnum ', title: ' Plan ', width:50, align: ' center ', sortable:true }, ${field: ' Actualnum ', title: ' Actual ', width:50, align: ' center ', sortable:true }, ${field: ' Hasallotednum ', title: ' Assigned ', WIDTH:50, align: ' center ', sortable:true }, -{field: ' Unitname ', title: ' Unit ', width:50, align: ' center ', sortable:true }, -{field: ' Specificationsname ', title: ' Specification Model ', WIDTH:60, align: ' center ', sortable:true }, the{field: ' Warehousename ', title: ' Shipping Warehouse ', width:100, align: ' center ', sortable:true }, -{field: ' ChannelName ', title: ' Channel ', width:30, align: ' center ', sortable:true },Wuyi{field: ' ID ', title: ' Operation ', width:120, align: ' center ', formatter:function(value, row) { the varRtnstr = ""; - if(Row. Status = = 0) { WuRtnstr = ' <a href= ' javascript:void () "class=" Gridacolor "onclick=" fproctask (1, ' + value + ') "> auto out of library </a> <a Href= "Javascript:void ()" onclick= "fproctask (0, ' + value + ')" class= "Gridacolor" > Manual out of Library </a> "; - } About returnRtnstr; $ } - } - ]], -GroupField: ' K3ordercode ', A View:groupview, + theGroupformatter:function(value, rows) { - varRtnstr = ""; $Rtnstr + = ' <input type= "checkbox" onclick= "Fgpckbclick (This)" helpgpval= "' + Value + '" name= "Gpchk"/> "; theRtnstr + = value + ' Document quantity = ' + rows.length + ' bar '; the varSumassignnum = 0; the varSumactualnum = 0; the for(vari = 0; i < rows.length; i++) { -Sumassignnum + =Rows[i]. Assignnum; inSumactualnum + =Rows[i]. Actualnum; the } theRtnstr + = "plan amount =" +Sumassignnum; AboutRtnstr + = "actual volume =" +Sumactualnum; the returnRtnstr; the } the});
View Code
Here are a few JS functions to implement this function
1 //Grouping CKB Events2 functionFgpckbclick (obj) {3 varGpval = $ (obj). attr ("Helpgpval");4 varisChecked = $ (obj). attr (' checked ') = = ' checked '?true:false;5Selectbygroup (isChecked, Gpval, ' #tbCheckOut ');6 }7 //grouped selected8 functionSelectbygroup (checked, value, Tableidselector) {9 varGroups = $ (tableidselector). DataGrid ("Options"). view.groups;Ten varrows; One for(vari = 0; i < groups.length; i++) { A if(Groups[i].value = =value) { -rows =groups[i].rows; - Break; the } - } - if(checked) { - for(vari = 0; i < rows.length; i++) { +$ (Tableidselector). DataGrid ("SelectRow", $ (Tableidselector). DataGrid ("Getrowindex", Rows[i])); - } + } A Else { at for(vari = 0; i < rows.length; i++) { -$ (Tableidselector). DataGrid ("Unselectrow", $ (Tableidselector). DataGrid ("Getrowindex", Rows[i])); - } - } - } - //CKB event at the top of the DataGrid in functionBoundckballclick () { -$ ('. Datagrid-header-check input '). Click (function () { to varisChecked = $ ( This). attr (' checked '); +$ (' input[name= ' Gpchk "]). each (function(index, ELEMETN) { - //alert (' N: ' + $ (this). attr (' Helpgpval ')); the if(isChecked = = ' checked ') { *$( This). attr (' checked ', isChecked); $}Else {Panax Notoginseng$( This). Removeattr (' checked '); - } the + }); A }); the}
View Code
Thanks to the park friend White Knight provides a way to perfectly solve
Easyui-datagrid Groupview The problem after the group check