dhtmlxgrid - How to make the row as read-only in the xml

A dhtmlxgrid has to be populated from an xml using mygrid.loadXMLString();, in the xml , how can we make the row type as read-only. For making the cell type as read-only , we use
'<cell align=‘left’ type=‘ro’ ’ in the xml for populating the grid. In a similar way what should be the command to make the entire row as read only.

The xml for populating the grid is shown below:

West 20101027 / 08:00 West 20101027 / 09:00

The in the xml has to be made read-only

The “type” attribute of a row isn’t processed automatically. However, there are getRowAttribute and setRowExcellType methods which can be used to set row type based on the row attribute:

<row id='1' type="ro">

grid.loadXML(url,function(){ grid.forEachRow(function(id){ var type = this.getRowAttribute(id,"type"); if(type) this.setRowExcellType(id,type); }) });

West

In JS 0 is the same as null. Therefore, it would be better if a row id were different from 0.

This technique works pretty good… however, I have cells in the row that are of type “co” and “ch”. When in “read only” mode, the “co” shows the option value (1, 2, 3, etc.) instead of the name of the field, and the “ch” shows a “1” or “0” depending on the state. Is there a way to make this show the data properly when in read only mode?

You need a bit more different logic to achieve such result , instead of this.setRowExcellType(id,type); you can use

this.forEachCell(id, function(cell){ cell.setDisabled(true); });

or just

this.lockRow(id, true);

both commands will block edit operations for row in question , without changing how row looks.

Can multiple rows be locked based on the value in one of the columns?

There is no automatic “lock-by-value” functionality.

Still, you can use event system of the component, and when specific value loaded or set by user, event handler can call lockRow API for row in question.