Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Luke Hepburn on May 01, 2009 06:08
open dhtmlx forum
set_row_style($style) with Connector (before render??)

I'm using the connector in my testing and I was easily able to manipulate the xml without having the connector so that I could pass certain styles to certain rows.

eg:
if ($myvalue == '1'){
print("<row id='".$row['myID']."' style='background-color:#00FF33;font-size:16px;'>");
} else {
print("<row id='".$row['myID']."''>");
}


I want to achieve this with the connector. I looked in the documentation and found the following.

$dataItem->set_row_style($style )

How do I apply this as I can't seem to find an example. Especially seeing I'm using dynamic loading as well. This is my code. I'm able to render the html link with before render easily enough but applying row cells to only values but not the row styles.


.....hyperlink before render statement

$grid->event->attach("beforeRender",custom_format);

$grid->dynamic_loading(150);
$grid->render_sql($mysql)
    

Thanks once again for your feedback.

Luke
Answer posted by Support on May 01, 2009 15:04
It can be used as

function custom_format($data){
     if (some_rule)
         $data->set_row_style("color:red;");
}
$grid->event->attach("beforeRender",custom_format);

>> I'm able to render the html link with before render easily enough
Beware that only one custom function can be attached to server event, so custom_format function must contain both custom link rendering code and custom style setting