Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by ez on Feb 23, 2009 09:00
open dhtmlx forum
cell type: stree - how to disable selection of specific nodes?

Hello!

I have master grid with stree column that contains items like this:

-item 1. openable, not selectable
--item 1.2 openable, not selectable
---item 1.2.1 selectable
---item 1.2.2 selectable
--item 1.3 openable, not selectable
---item 1.2.1 selectable
---item 1.2.2 selectable

I want to only specific nodes be selectable, so that double click on eg. item 1.2 only open the 1.2 but not select 1.2

Currently, when I click on item 1.2 my tree grid return item 1.2 value to master grid

I manage to block the selection by this code:

tree.attachEvent("onClick", function(rowId) {        
        if(!tree.getUserData(rowId,"selectable")) {
            tree.openItem(rowId);
alert("You cannot select this node");        
        }
});    


But this also works on single click, and I don't want that.

Answer posted by Support on Feb 24, 2009 02:11
Behavior can be changed only by modification in dhtmlxgrid_excell_tree.js

dhtmlXGridObject.prototype.setSubTree=function(tree,s_index,t_index){
...
        tree.setOnDblClickHandler(function(id){
            that._sub_id = id;
            that.editStop();
            return true;
        });

Can be changed as 

dhtmlXGridObject.prototype.setSubTree=function(tree,s_index,t_index){
...
        tree.setOnDblClickHandler(function(id){
  if(!this.getUserData(id,"selectable")) return true;
            that._sub_id = id;
            that.editStop();
            return true;
        });