View Full Version : Metadata for a selected cell.

23 Jul 2010, 11:15 AM
Hi All,
I have a grid with a context menu on a specific column.

When I right-click a cell in that column, a context menu pops up, the user selects an option and an Ajax request is sent to the server. This works fine.

Here is my problem. Once the user makes a selection from the context menu, I would like to change the font of the data in the cell, or maybe change the color. (without reloading the entire grid)

I can see how this is done with a renderer by getting the metadata from the cell.

I can not figure out how to call the renderer or to get the cell's metadata unless the data has been changed by the user or unless the grid has been reloaded.

Maybe there is a better way to do this but calling the renderer makes sense if I can figure out how to do it without changing data. Or if I can just get the metadata for the selected cell.

1a. How can I get hold of (and then modify) the metadata (the style) for a cell when that cell is selected.
1b. How can I call the renderer without a user changing data in the cell?
2. Is there a better way to do this?


25 Jul 2010, 6:15 AM
There are 2 methods.
1. Add an extra field to your record that holds a 'changed' flag that is used by the renderer to render in a different color. The menu handler then only has to set the changed field in the current record.
2. Modify the gridview cell directly. This is only a temporary change and it is lost when the grid data is modified (e.g. when reloaded, sorted or updated).

Ext.fly(grid.getView().getCell(row, col)).addClass('some-class');