Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tosh on Nov 10, 2008 22:39
open dhtmlx forum
dhtmlx Checkbox disable

Hello again.. :D
I bump into another problem hopes you can help me again. I have a column checkbox which is the first column of my grid and I need to disable some of them for some reason. The grid content was dynamic having dynamic pagination even the headers come from xml.

Now the question, Is there a way or maybe an attribute I can set on a cell that will disable this checkbox during loading of XML?

One method Im using is using the userdata and running the forEachRow internal function of the grid during XLE operation for selecting those checkbox that needed to be disabled. Like:

grid.attachEvent('onXLE', function () {
grid.forEachRow( function(id) {
grid.cells(id,0).setDisabled( grid.getUserData(id,'isdisable'));
}
});

If there is no attribute for setting the disabled checkbox then
Is there a better way to do the above implementaion so that I would not need to scan all rows over again and scan only those newly loaded rows?

Thanks,

Tosh
Answer posted by Support on Nov 11, 2008 03:14
There is no separate attribute , but you can use in XML
   <cell disabled="true">1</cell> 
and in js code
grid.attachEvent("onRowCreated",function(id){
     var cell = grid.cells(id,0); //checkbox cell
     if (cell.getAttribute("disabled")) cell.setDisabled(true);
})
Answer posted by Tosh on Nov 11, 2008 21:29
Wow, your d best! Exactly what I'm looking for.

I just wish I knew that event before. Maybe I'll scan the source code for some other more usefull events.

Thanks,
Tosh