Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mario on Jan 14, 2010 04:08
open dhtmlx forum
Is it possible to have dhtmlxGrid configured with XML and data loaded with render_sql

I am using a connector to have data loaded from php to dhtmxGrid. I am using render_sql to load data. But I would like to configure the column types, like editable or not. I have not found a way to do this directly. Also I would like to avoid getting everything (config and data) from a single XML because it is not so elegant.

Can you please tell if there is a way to do this?

Thanks in advance
Answer posted by Alex (support) on Jan 14, 2010 07:26

there is no opportunity to define editable state by render_sql. Try to use onBeforeRender event:

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

function before_render(){

    /*your code here that sets editable attribute for the cell:  $dataItem->set_cell_attribute($name,$attr,$value); method*/

}

http://www.dhtmlx.com/dhxdocs/doku.php?id=dhtmlxconnector:griddataitem_treegriddataitem_specific

In this case it will be possible to block editing for cells where this attribute is 0 ( http://www.dhtmlx.com/dhxdocs/doku.php?id=dhtmlxgrid:event_oneditcell ): 

grid.attachEvent("onEditCell",function(stage,id,index){

    return grid.cells(id,index).getAttribute("editable");

})