1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    UK
    Posts
    28
    Answers
    1
    Vote Rating
    0
    BoroChris is on a distinguished road

      0  

    Default 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?

  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:

    Code:
    renderer: function(value, metaData, record) {
        if (record.get('deleted')) {
            metaData.style = 'border: 3px solid red;';
        }
    					
        return value;
    }
    You can also use metaData.tdCls to attach a class to the td element.

  3. #2
    Touch Premium Member
    Join Date
    Feb 2011
    Location
    NJ
    Posts
    311
    Answers
    59
    Vote Rating
    51
    droessner is a jewel in the rough droessner is a jewel in the rough droessner is a jewel in the rough

      0  

    Default


    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:

    Code:
    renderer: function(value, metaData, record) {
        if (record.get('deleted')) {
            metaData.style = 'border: 3px solid red;';
        }
    					
        return value;
    }
    You can also use metaData.tdCls to attach a class to the td element.

  4. #3
    Sencha User
    Join Date
    Mar 2012
    Location
    UK
    Posts
    28
    Answers
    1
    Vote Rating
    0
    BoroChris is on a distinguished road

      0  

    Default


    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?

  5. #4
    Sencha User
    Join Date
    Mar 2012
    Location
    UK
    Posts
    28
    Answers
    1
    Vote Rating
    0
    BoroChris is on a distinguished road

      0  

    Default


    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

Thread Participants: 1