PDA

View Full Version : Force grid column renderer to re-execute.



greglafrance007
18 Dec 2014, 2:44 PM
I have an ExtJS 4.2.2 grid with a column.

The data in the cells is calculated in a renderer using data stored elsewhere. It renders fine.

After the grid has been displayed, the "data stored elsewhere" that is used to calculate the grid cell values changes, so how do I force the cells renderers to be re-executed?

I don't want to refresh the entire table, just the data in those cells.

Thanks in advance!

lumberjack
30 Dec 2014, 10:58 AM
The value presented by the column renderer should update if the data it's bound to changes. What you might need to do is override the set method in your model to ensure that any computed fields are recomputed if they are dependent upon other fields.

The fiddle below demonstrates a few things:
Field with a convert function: The SuperHero model has a field, color, that uses a convert function which searches the email for "hulk" to determine if the color should be green or normal
Overridden set method in model: The SuperHero model's set method has been overridden to automatically recalculate the color field if the email field is changed
Grid with custom renderers: The Email and Color columns in the grid both use a custom renderer function, which will update the value presented in the cell when it's data is changed
Does this fiddle answer your questions?

Regards,
Brian

https://fiddle.sencha.com/#fiddle/fnh
fnh