Zebraed Table in HTML with Ext JS

3

I need to make a zebrada table in the Xtemplate functionality of ExTJS 4.1.2 where I have two for loop. I implemented a basic HTML, but does anyone have any idea how to do it?

    
asked by anonymous 17.12.2013 / 20:43

2 answers

5

According to this page , even rows of a grid have the class CSS x-grid-row-alt . So, you just have to define different colors for the x-grid-row and x-grid-row-alt classes in your CSS:

x-grid-row .x-grid-cell { 
    background-color: #fff; 
    color: #000; 
} 

.x-grid-row-alt .x-grid-cell { 
    background-color: #000; 
    color: #fff; 
}
    
17.12.2013 / 20:56
1

I imagine there are more elegant ways, using a table, or a grid, but in case you are generating the list through a for / foreach, you can

    for ($i=0;$row[$i];$i++){
        if ($i %  2  !=  0){//estou apenas verificando se é uma div par
            echo"<div class='dark'> ... <\div>";
        }esle{
            echo"<div class='light'> ... <\div>";
        }  
    }

And in the .css style sheet

.dark { 
    background-color: #fff; 
    color: #000; 
} 

.light { 
    background-color: #000; 
    color: #fff; 
}
    
17.12.2013 / 21:17