1. #1
    Sencha User
    Join Date
    Jan 2012
    Location
    Rennes - France
    Posts
    172
    Answers
    2
    Vote Rating
    1
    Thierryg is on a distinguished road

      0  

    Default Unanswered: Alternate background color on item's list

    Unanswered: Alternate background color on item's list


    Hi,

    I wanna know how to alternate the background color for item's list.

    Indeed i wanna have even items with a white background color and odd items with light blue background color. Thus with an alternate, it can provide a nice colorization.

    Thank you for your reply.

    Regards

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Answers
    3542
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You can use CSS puesdo selectors to add it to the rows.

    http://www.w3.org/TR/selectors/
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Answers
    93
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    There is also a SASS variable available to do this:

    http://docs.sencha.com/touch/2-0/#!/...st-zebrastripe
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  4. #4
    Sencha User
    Join Date
    Dec 2012
    Posts
    3
    Vote Rating
    0
    nishant.chandwani is on a distinguished road

      0  

    Default


    First add model field ------name is "test_id" and add function and add one variable and increment with +1 ,
    Then go to item tpl
    <tpl for=".">
    <tpl if="this.fnsetClass(test_id)==0">
    {name}
    <tpl elseif="this.fnsetClass(test_id)==1">
    {name}
    </tpl>
    </tpl>
    and add function name id fnsetClass
    if(rec % 2===0){
    $('.x-inner .x-list-item-inner').css('color','red');
    return 1;
    }
    else{
    $('.x-inner .x-list-item-inner ').css('background-color','grey');
    return 0;
    }

    there is " .x-inner .x-list-item-inner " html contain class this may be change get the class name and change .......



    thanks