ParamQuery Grid
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Search
Login
Register
ParamQuery grid support forum
»
General Category
»
Help for ParamQuery Pro
»
Render function
« previous
next »
Print
Pages: [
1
]
Author
Topic: Render function (Read 4240 times)
queensgambit9
Pro Ultimate
Sr. Member
Posts: 341
Render function
«
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)?
Logged
paramvir
Administrator
Hero Member
Posts: 6314
Re: Render function
«
Reply #1 on:
September 11, 2017, 04:43:03 pm »
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.
Logged
queensgambit9
Pro Ultimate
Sr. Member
Posts: 341
Re: Render function
«
Reply #2 on:
September 11, 2017, 06:28:49 pm »
Thanks, any suggestions how I should parse all cell data (all columns and rows) in an efficient way with render?
«
Last Edit: September 11, 2017, 07:22:26 pm by queensgambit9
»
Logged
paramvir
Administrator
Hero Member
Posts: 6314
Re: Render function
«
Reply #3 on:
September 11, 2017, 07:42:24 pm »
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
«
Last Edit: September 11, 2017, 07:46:03 pm by paramquery
»
Logged
queensgambit9
Pro Ultimate
Sr. Member
Posts: 341
Re: Render function
«
Reply #4 on:
September 11, 2017, 07:53:05 pm »
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?
Logged
paramvir
Administrator
Hero Member
Posts: 6314
Re: Render function
«
Reply #5 on:
September 11, 2017, 07:58:15 pm »
columnTemplate can be used to define render for all columns.
https://paramquery.com/pro/api#option-columnTemplate
Logged
queensgambit9
Pro Ultimate
Sr. Member
Posts: 341
Re: Render function
«
Reply #6 on:
September 11, 2017, 09:12:15 pm »
Great, thanks.
Logged
Print
Pages: [
1
]
« previous
next »
ParamQuery grid support forum
»
General Category
»
Help for ParamQuery Pro
»
Render function