Hallo,
we use summaries feature and we want to add units to summaries on a per column basis. But we can only set a summary resultTemplate for the whole grid. how can we achieve this?
See: http://jsfiddle.net/maxschaf/xBMDs/3/
Hello Max,
Thank you for the sample.
I am currently looking into your question and will keep you posted of my progress.
Thank you for your patience.
The summaries behavior does not currently directly offer the functionality of setting per column result templates. Please feel free to submit a product idea regarding this functionality at: <ideas.infragistics.com>.
In this case I would suggest not using the result template, but instead handling the summariesCalculated event and manually modifying the summary text for the desired column:
http://jsfiddle.net/xBMDs/4/
Hope this helps. Please do not hesitate to contact me with any questions.
hi,
thanks for your answer. Your solution using jQuery Selectors works, but selecting the cell out of the DOM and manipulating it is slow for large grids.
I experienced, that setting a formatter function to a column also effects the summary generation, so it's possible to style/template the summary at generation time without dom manipulation. But this behavior is a bit strange. Setting a template to a column does not effect summary generation, but setting a formatter does :P .
I experienced this execution sequence:
- 1. formula (applied to every cell)
- 2. formatter (applied to every cell and every summary operand afterwards)
- 3. template (applied to every cell)
to prevent the cell style from being applied twice (wrong e.g. "12.44 ha ha" => right "12.44 ha"), I only format strings by the formatter function, because summaries calls the formatter function with strings (regional settings applied) and a cell calls the formatter with a number (using it in a dataType: number column).
to apply the regional settings to cell values automatically by iggrid I have to use a column template there, because a cell calls the formatter function with a non-formatted number instead of a formatted string.
see the magic happening: http://jsfiddle.net/maxschaf/xBMDs/5/
Thank you for sharing your solution!
well. my solution is not working correctly after all. if a formatter function is defined, templating is working. but the regional settings to numbers are not applied.
is this a bug or a feature? :)
it not really clear, when which templating, formatting, format property is working where. What influences editors, summaries,... . you should provide a flowchart or some graphics :) .
Hi Max,
My apologies, I misunderstood the issue. I am currently looking into that matter and will keep you posted of my findings.
I have researched this further and there seems to be no other approach of implementing this in this scenario since the formatter function does not apply any regional or other formatting on its own (by design its purpose is to leave the formatting completely to the developer).
I would suggest considering directly changing the values in the summary cells again. Note that since the summary information is located into a separate table than the grid cells, the performance effect should be limited. Please let me know if you are experiencing performance issues in a larger grid with the current selector, as this should not happen at the moment. I would suggest considering to submit a product idea regarding the ability to specify per-column summary templating functionality.
Please do not hesitate to contact me if you have any questions.