PDA

View Full Version : Need EditorGrid to always re-render.



extjosh
21 Jan 2011, 2:43 PM
I have a EditorGridPanel with some a ColumnModel with a couple of custom renderers and editors. The editors may return the same value after the user tabs out even if the user has actually selected a different option in a combobox in the editor. I need the renderer to be forced to re-render to reflect the different combobox value, even though the editor returns the same thing after editing for getValue(). Is there any way to do this that isn't too painful?
Thanks

aconran
21 Jan 2011, 3:39 PM
editorGrid.getView().refresh();

extjosh
21 Jan 2011, 3:57 PM
Will that just refresh the whole grid based on the data in the store? I want to re-render the cell that's being edited based on what's in the editor.

aconran
21 Jan 2011, 4:04 PM
extjosh - yes, it's the only public method thats going to do what you want though...

You need to trigger a change in the record and the grid will update itself.

You could also invoke the private method refreshRow(record). This will be changing in Ext 4 and is subject to breaking but it should work the entire 3.x branch...



editorGrid.getView().refreshRow(record);

extjosh
21 Jan 2011, 4:09 PM
The record does not contain the info I need to update the grid cell. If the user is editing a cell and convert 32F to 0C by selecting C in the ComboBox, I want it to render as 0C, even though the value in the record does not change.

aconran
21 Jan 2011, 4:11 PM
... Doesn't matter, invoke refreshRow on the gridview and should refresh that specific row

extjosh
21 Jan 2011, 4:21 PM
What exactly 'doesn't matter'? How does it refresh it? It does not appear to help me. Are you saying that the refresh will re-render the editors' values into the grid for that row? When should I call this?

aconran
21 Jan 2011, 4:27 PM
It will re-render that particular record and execute its renderers etc.. Call it after the editor completes to repaint the row

extjosh
21 Jan 2011, 5:08 PM
Thank you so much. :)