Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summary not formatted on grouping header #1034

Closed
fredsal opened this issue Jun 9, 2023 · 11 comments
Closed

Summary not formatted on grouping header #1034

fredsal opened this issue Jun 9, 2023 · 11 comments

Comments

@fredsal
Copy link
Contributor

fredsal commented Jun 9, 2023

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

@tonytomov
Copy link
Owner

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

@fredsal
Copy link
Contributor Author

fredsal commented Jun 12, 2023

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

@fredsal
Copy link
Contributor Author

fredsal commented Jun 12, 2023

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

@tonytomov
Copy link
Owner

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

@fredsal
Copy link
Contributor Author

fredsal commented Jun 12, 2023

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
     )
],

@tonytomov
Copy link
Owner

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.

@fredsal fredsal closed this as completed Jun 12, 2023
@fredsal
Copy link
Contributor Author

fredsal commented Jun 12, 2023

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

@fredsal
Copy link
Contributor Author

fredsal commented Jun 12, 2023

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

@parallels999
Copy link

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

@tonytomov
Copy link
Owner

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

@parallels999
Copy link

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

that would be great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants