beforeRender to color rows working only on alternate rows

Hello all,
I wanted to color rows that met certain conditions, by following the example in … re_loading

I tried and failed, so I tried something very simple. I changed the code to color every row red of a simple grid as follows:

<?php require_once("./toitoi_config.php"); require_once("./dhtmlx/connector/codebase/grid_connector.php"); $res=mysql_connect($mysql_server,$mysql_user,$mysql_pass); mysql_select_db($mysql_db); function color_rows($row){ $row->set_row_color("red"); } $grid = new GridConnector($res); $grid->dynamic_loading(100); $grid->event->attach("beforeRender","color_rows"); $grid->render_table("clienti","CODICE","COGNOME_NOME,RAG_SOCIALE2,INDIRIZZO,CITTA_RES,CAP,PV,CONTATTO"); ?>

What happens is that the rows get colored alternatively (i.e. one red, one white, one red, etc)

Some grid skins can define colors for even|odd rows, which may conflict with server side settings.

Instead of $row->set_row_color(“red”); you can use


and on client side have something like

tr.marked td{ background-color:red !important; }

Thank you Very much, Stanislav,

that was very useful!