tonytomov / jqGrid

jQuery grid plugin
www.trirand.com
2.84k stars 1.2k forks source link

Unconsistente behaivor on `summaryTpl` and `groupText` #1015

Closed PaolaRuby closed 2 years ago

PaolaRuby commented 2 years ago

On groupText i can use another cols, but if i try the same on summaryTpl it gives me undefined How can i achieve the same result on both??

Maybe is a bug or it is not supported and could be a new feature

Using: jqGrid JS - v5.7.0 image DEMO: https://jsfiddle.net/yLzmop75/1/

///
colModel: [
   ///
   { 'name': 'col', summaryType:'sum', summaryTpl:'<b>{0} - {group_name}</b>' }, // get undefined
],
grouping: true,
groupingView: {
  groupField: ['group'],
  groupText:["{0} - <b>{group_name}</b>"], // it works
  ///
PaolaRuby commented 2 years ago

Hi again,

-tmpdata= "<td "+$t.formatCol(k,1,'')+">"+$.jgrid.template(tplfld, vv, fdata.cnt, fdata.dataIndex, fdata.displayValue)+ "</td>";
+tmpdata= "<td "+$t.formatCol(k,1,'')+">"+$.jgrid.template(tplfld, vv, fdata.cnt, fdata.dataIndex, fdata.displayValue, fdata.summary)+ "</td>";

https://github.com/tonytomov/jqGrid/blob/10bca9a05bdec7eb69885bc6c7bf4306161fa14b/js/grid.grouping.js#L346 looks like adding fdata.summary on that line fix the problem image DEMO: https://jsfiddle.net/nh9a7xo2/

tonytomov commented 2 years ago

Thanks for look at this. With your solution you can attach fields only if they have summaryTpl property. Any field without this property can't be set. Instead of this I will include your solution.

Thank you.

PaolaRuby commented 2 years ago

Thanks Of course, only when they have summary property, same functionality as groupText