1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    25
    Answers
    1
    Vote Rating
    1
    edd82 is on a distinguished road

      0  

    Default Answered: How to change text colour on Ext.List items according to different field values

    Answered: How to change text colour on Ext.List items according to different field values


    I have a Ext.List that is connected to a Store. There is an ID and status field in the model and I want to change the colour of the ID that appears in the LIST according to the value of the status field.

    I can use the "itemTpl" config to include HTML to change the font colour but I don't know how to do this dynamically.

    Can anyone help with this?

  2. Ignore me, I've just found out the power of XTemplate!!!

    For anyone else who hadn't quite followed the documentation correctly:

    itemTpl: new Ext.XTemplate(
    '<tpl if="id &gt; 1">',
    '<font color="red">{id}</font>',
    '</tpl>',
    '<tpl if="id &lt; 1">',
    '<font color="blue">{id}</font>',
    '</tpl>',
    { isOnline:function(){return "offline"}}

  3. #2
    Sencha User
    Join Date
    Nov 2011
    Posts
    25
    Answers
    1
    Vote Rating
    1
    edd82 is on a distinguished road

      0  

    Default


    Ignore me, I've just found out the power of XTemplate!!!

    For anyone else who hadn't quite followed the documentation correctly:

    itemTpl: new Ext.XTemplate(
    '<tpl if="id &gt; 1">',
    '<font color="red">{id}</font>',
    '</tpl>',
    '<tpl if="id &lt; 1">',
    '<font color="blue">{id}</font>',
    '</tpl>',
    { isOnline:function(){return "offline"}}

Tags for this Thread