// Grouping module ;(function($){ $.jgrid.extend({ groupingSetup : function () { return this.each(function (){ var $t = this, grp = $t.p.groupingView; if(grp !== null && ( (typeof grp === 'object') || $.isFunction(grp) ) ) { if(!grp.groupField.length) { $t.p.grouping = false; } else { for(var i=0;i"; try { gv = $t.formatter(hid, grp.sortnames[0][i], cp, grp.sortitems[0] ); } catch (egv) { gv = grp.sortnames[0][i]; } str += ""+icon+$.jgrid.format(grp.groupText[0], gv, grdata[n].length)+""; for(var kk=0;kk"; var fdata = grp.summaryval[0][n], cm = $t.p.colModel, vv, grlen = grdata[n].length; for(var k=0; k ", tplfld = "{0}"; $.each(fdata,function(){ if(this.nm == cm[k].name) { if(cm[k].summaryTpl) { tplfld = cm[k].summaryTpl; } if(this.st == 'avg') { if(this.v && grlen > 0) { this.v = (this.v/grlen); } } try { vv = $t.formatter('', this.v, k, this); } catch (ef) { vv = this.v; } tmpdata= ""+$.jgrid.format(tplfld,vv)+ ""; return false; } }); str += tmpdata; } str += ""; } }); $("#"+$t.p.id+" tbody:first").append(str); // free up memory str = null; }); }, groupingGroupBy : function (name, options, current) { return this.each(function(){ var $t = this; if(typeof(name) == "string") { name = [name]; } var grp = $t.p.groupingView; $t.p.grouping = true; // show previoous hidden groups if they are hidden for(var i=0;i