Jul 09, 2012, 8:40 AM
Gridpanel: change cell's css class on click (eg. toggle the cell background color)
Hi
In my Gridpanel I would like a cell's background color to toggle every time it is clicked (eg. white to green on first click, green to white on next click, etc).
I presume altering the cell's css class (either changing from one class to another, or adding/removing an extra class) would be the best way to do this but I can't get it working dynamically. (I have also tried toggling the Dirty property of the cell to achieve the same effect but could not get this working either). I am using a CellSelectionModel but that only affects the currently selected cell and i would like the cells to keep their color status after being clicked, eg:
I have found a few examples involving column renderers or Ext.fly but are for version 1 and I can't get them working for version 2. eg:
http://forums.ext.net/showthread.php...ter-row-select
http://forums.ext.net/showthread.php...with-DataIndex
http://forums.ext.net/showthread.php...ngle-in-corner
If anyone could show me how to toggle a cell's background color on a cell click I would be very grateful.
Thanks.
In my Gridpanel I would like a cell's background color to toggle every time it is clicked (eg. white to green on first click, green to white on next click, etc).
I presume altering the cell's css class (either changing from one class to another, or adding/removing an extra class) would be the best way to do this but I can't get it working dynamically. (I have also tried toggling the Dirty property of the cell to achieve the same effect but could not get this working either). I am using a CellSelectionModel but that only affects the currently selected cell and i would like the cells to keep their color status after being clicked, eg:
I have found a few examples involving column renderers or Ext.fly but are for version 1 and I can't get them working for version 2. eg:
http://forums.ext.net/showthread.php...ter-row-select
http://forums.ext.net/showthread.php...with-DataIndex
http://forums.ext.net/showthread.php...ngle-in-corner
If anyone could show me how to toggle a cell's background color on a cell click I would be very grateful.
Thanks.