ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: Digitalsoft on September 28, 2020, 02:01:53 pm
-
In the tree grid example with checkbox , how to change the summary on group level based on check box select/unselect
-
{
type: 'checkbox',
label: 'summary',
listener: function(evt){
this.Tree().option({summary: evt.target.checked});
}
}
-
https://paramquery.com/forum/index.php?topic=3822.msg13876#msg13876
In this to get the checked rows on check/uncheck you asked to use 'check' event, Inside this event I want to change the summary on check/uncheck of the checkboxes
-
That is what I understood from your requirement. Please elaborate if your requirement is different.
-
Consider the checkboxes are checked initially, so the summary is 22. If the user uncheck 'Chrome' then summary should be updated as 17. If 'Chrome' is checked again then summary should be 22.This is my requirement
-
It's a new use case.
It can be solved though with help of custom aggregate and one private method ( refreshSummary ) of treegrid.
//define custom aggregate.
pq.aggregate.sumEx = function(arr, col, rows) {
var sum = 0, di = col.dataIndx;
rows.forEach(function(rd) {
if (rd.pq_tree_cb) {
sum += rd[di] * 1 || 0;
}
});
return sum;
};
check: function() {
this.Tree().refreshSummary(true); //private API
},
https://stackblitz.com/edit/paramquery-demo-dptepp?file=index.js
-
Okie, How to show the summary at the top instead of showing in the bottom. i.e in the 'Android' row
-
Hi, Any update on the above question ?
-
In treegrid, summary row can be displayed at the bottom of every collapsible node only.
Can you please share a screenshot where exactly do you want to display the summary so that I can look into its feasibility.
-
Please refer the screenshot, like this I want to show summary at top
-
There is no direct configuration option to display summary in the same row as folder nodes, however Excel formulas can be used for this task.
Please check this example:
https://paramquery.com/pro/demos/treegrid_excel