ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: queensgambit9 on September 11, 2017, 01:46:46 pm
-
I would like to add an image if cellData contains certain criteria. Currently I use the render function which works fine (used in colModel).
When applying to all cells...what would be the best approach thinking of speed etc?
Would it be possible to add html attributes etc already in the datamodel (using json data)?
-
It's fine to do it with render, it doesn't affect the speed in most of the cases, unless there is inefficient code written inside render.
postRender can also be used.
Adding html entities inside json data is not good from security point of view.
-
Thanks, any suggestions how I should parse all cell data (all columns and rows) in an efficient way with render?
-
You don't need to parse through all rows and columns to get cell value which is readily available as ui.cellData
Writing efficient code in render function boils down to writing efficient javascript code:
1. caching object properties,
2. avoiding loops,
3. use grid instance to call pqgrid methods.
https://paramquery.com/pro/tutorial#topic-methods
-
Thanks. Not sure how to execute it once for all data...currently I use render in the colmodel... how can I trigger for all columns?
-
columnTemplate can be used to define render for all columns.
https://paramquery.com/pro/api#option-columnTemplate
-
Great, thanks.