How can I lock columns or make read-only?
Is it possible to use the settings from the XML where i get the other Data?
How can I lock columns or make read-only?
Is it possible to use the settings from the XML where i get the other Data?
The simplest solution - specify column type as “ro” - which will make it readonly
It can be done for whole column
<column type=“ro”
or for specific cells only
<cell type=“ro”
It possible to lock columns without changing their type, but it will require adding of some client side code.
Hello thank you for the answer.
I tested your solution. But if i change the type of a checkbox. He shows me the value and not the checkbox. I only want to freeze/lock the column.
So how can it be done without changing the type?
it doesnt matter if i add some client code. It would be Great if i could declare it for each Column in the “get.php” where i make the XML.
for example:
<column width="50" type="co" align="center" sort="" locked="1">
Is that possible too?
Is that possible too?
No, its not possible
You can disable checkbox column to edit with setDisabled(true) method:
mygrid.cellById(rowId,cellIndex).setDisabled(true);
If you are not using Smart Rendering mode, you can iterate through all rows with forEachRow() method and disable each row docs.dhtmlx.com/doku.php?id=dhtm … terating&s[]=forEachRow
If you have a lot of rows in your grid its better to use “onRowCreated” event. docs.dhtmlx.com/doku.php?id=dhtm … rowcreated
Also, you can store extra data, with info which columns need to be locked in user data
<rows>
<userdata name="locked">3</userdata>
...
on client side
grid.attachEvent("onEditCell",function(stage, id, ind){
if (grid.getUserData("","locked") == ind) return false;
return true;
}