jQuery UI Widgets › Forums › Grid › groupsrenderer function with same fields of detail lines
Tagged: groupsrenderer
This topic contains 6 replies, has 2 voices, and was last updated by pt-jcoelho 12 years, 2 months ago.
-
Author
-
Hi
I’m testing if the jqxGrid fills the project requirementshttp://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/groupsrenderer.htm?arctic
The above example uses a groupsrenderer function.
The problem is that the group line only has one field.My project requires that the group line has the same fields than the detail lines with Sums, Averages, %, etc of detail lines values.
I have looked at the demos and fóruns and was unable to find information in how to do this?
Can you provide one example of this?Best Regards
Hi pt-jcoelho,
Unfortunately, our Grouping implementation does not have detail lines. It is possible only to use the Group line.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter
I think that you have not understoud.
The example has the detail lines.
The problem is that the group line does not has the same fields as the detail lines.How can this be implemented by the groupsrenderer function?
Best Regards
Hi pt-jcoelho,
What kind of fields you are looking for in the Group line? As you can see from the sample, the HTML returned by the groupsrenderer function is what the Grid displays.
var groupsrenderer = function (text, group, expanded, data) { if (data.groupcolumn.datafield == 'price' || data.groupcolumn.datafield == 'quantity') { var number = dataAdapter.formatNumber(group, data.groupcolumn.cellsformat); var text = data.groupcolumn.text + ': ' + number; if (data.subItems.length > 0) { var aggregate = this.getcolumnaggregateddata(data.groupcolumn.datafield, ['sum'], true, data.subItems); } else { var rows = new Array(); var getRows = function (group, rows) { if (group.subGroups.length > 0) { for (var i = 0; i < group.subGroups.length; i++) { getRows(group.subGroups[i], rows); } } else { for (var i = 0; i < group.subItems.length; i++) { rows.push(group.subItems[i]); } } } getRows(data, rows); var aggregate = this.getcolumnaggregateddata(data.groupcolumn.datafield, ['sum'], true, rows); } return '<div class="' + toThemeProperty('jqx-grid-groups-row') + '" style="position: absolute;"><span>' + text + ', </span>' + '<span class="' + toThemeProperty('jqx-grid-groups-row-details') + '">' + "Total" + ' (' + aggregate.sum + ')' + '</span></div>'; } else { return '<div class="' + toThemeProperty('jqx-grid-groups-row') + '" style="position: absolute;"><span>' + text + '</span>'; } }Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi
I’m looking the same fields as the detail rows but with Sums, Averrages, etc.
Is it possible?Best Regards
Hi pt-jcoelho,
Here’s how to display the Quantity Data Field next to the Price: http://jsfiddle.net/jqwidgets/kncHv/1/. The Quantity information represents the sum of all quantity cells in the group.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter
I need the Agregate values to be under the cell hearders.
Sum of Quantity under Cell Header “Quantity”
Sum of Price under Cell Header “Price”
I have sent one print screen to support@jqwidgets.com that show the old ActiveX grid that i need to replace.Is it possible?
Thanks in advance
-
AuthorPosts
You must be logged in to reply to this topic.