tonytomov / jqGrid

jQuery grid plugin

Home Page:www.trirand.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Summary not formatted on grouping header

fredsal opened this issue · comments

commented

On footer row and footer group the field appears formatted, but on header group doesn't

image

Demo: https://jsfiddle.net/132xkcLa/

Best regards, Fred

I try to fix the problem. Please let me know if the fix work for you.

commented

With that the demo is not showing anything
Master: https://jsfiddle.net/1wqLn8fc/ (d8be545)
V5.8.2: https://jsfiddle.net/9knq2u1g/

commented

How about making it optional, so you avoid breaking changes?
Example:
summaryFormat: 'currency'
Or
summaryFormat: true, when true it uses formatter from colModel

there are many custom formatters, and I don't think they can be applied to the group header row

In jqGrid setup of your demo change datatype from 'local' to 'json'. It work for me when I do this change.

commented

I found another way,
apparently you can set a callback on groupText, not pretty, but works

Example: https://jsfiddle.net/v0pjmkts/

 groupText:[(gv,n,s)=>
     $.jgrid.template(
       	'{0}<span class="right"><b>TOTAL:</b>&nbsp;&nbsp;{2}</span>',
        gv,n,$.fn.fmatter.call(grid[0],'currency',s[1].v),s
     )
],

By default summary fields are formated with the formatter when applied. The data on header and footer row can be formated and can be not depending on the parameter - formatHeaderData formatFooterData. The only exception was the grouping text, which is fixed with last commit.

commented

Ok, my mistake, seems to be working fine, thank you very much

commented

One question, after changing the values ​​of any cell, is there a function to force the recalculation of the summary of that group?

Example: https://jsfiddle.net/Lbuvyt3z/
image

With reloadGrid it works

grid.trigger('reloadGrid',{page:1});

the only way is reloadGrid, Or is there a method for update only the selected group?
I'm trying to avoid groupingRemove and groupingGroupBy again

hi @tonytomov,

I use gridConc.getGridParam("groupingView").groups for getting group totals(for custom calculations)
With this change, now i only get formated values(breaking change for me),
there is a possibility that we can get the value without formatting too, for example

v : 'FORMATED_VALUE',
vv: UNFORMATD_VALUE

I have added this requirement, but the property is named uv (un-formatted value) . Maybe it is a good idea to have option what to display - formatted or un-formatted value

Maybe it is a good idea to have option what to display - formatted or un-formatted value

that would be great