-
29 Jan 2013 6:27 AM #1
Answered: Is it possible to alter a grid cell border from within store data
Answered: Is it possible to alter a grid cell border from within store data
I have a VERY dynamic grid that is basically controlled from the data store.
The data already does formatting of the cell contents using embedded <bodyStyle> but there is also a requirement to affect the cell border but I cannot find a way to do this.
I have tried all of the <style> types that I could find but not of these seem to affect the cell border, Mainly I suspect because this is a higher level div.
This may seem an odd way to do this but due to the nature of this grid it would be extremely difficult to do this any other way.
Is there a way to do this?
-
Best Answer Posted by droessner
You could add a column renderer and then add styling to the cell depending on a value in the store.
See http://docs.sencha.com/ext-js/4-1/#!...n-cfg-renderer
For example, lets say you have a record value of "deleted" in your store and you want to add a red border to the cell in that column when the deleted value is true you would do something like this:
You can also use metaData.tdCls to attach a class to the td element.Code:renderer: function(value, metaData, record) { if (record.get('deleted')) { metaData.style = 'border: 3px solid red;'; } return value; }
-
29 Jan 2013 9:04 AM #2
You could add a column renderer and then add styling to the cell depending on a value in the store.
See http://docs.sencha.com/ext-js/4-1/#!...n-cfg-renderer
For example, lets say you have a record value of "deleted" in your store and you want to add a red border to the cell in that column when the deleted value is true you would do something like this:
You can also use metaData.tdCls to attach a class to the td element.Code:renderer: function(value, metaData, record) { if (record.get('deleted')) { metaData.style = 'border: 3px solid red;'; } return value; }
-
30 Jan 2013 2:23 AM #3
thank you, that may well point me in the right direction.
I can't seem to find an equivalent for a row rather than a column.
It would be good if there was a way to affect the entire row based on one cell value (it would be the first in the row).
I have tried using viewconfig getRowClass but applying the style there seems to be overridden by each cell. could I somehow set the metaData style in there?
-
30 Jan 2013 4:51 AM #4
thanks,
have managed to get it to work using your code. Probably not that efficient as I am having to do it on every column to get a row effect but at least have it working


Reply With Quote