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.
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 .......