tags:

views:

5

answers:

0

Hi people! I have worked out a tree which I fed with data, for certain elements I'd love to deactivate "drag&drop", which doesn't work and I don't know why. If you have the answer I would kindly thank you.

The task is that certain element shouldn't be draggable, if I set

subWidgets[0][subWidgets[1]].dragRestriction = true;

it is in the view (browser) still draggable. The hell I know why :(

           var tree = new dijit.Tree({
                model: treeModel,
                dndController: "dijit.tree.dndSource"
            },
            "treeThree");           

                var widgets = tree.rootNode.getChildren();
                var subWidgets = new Array();

                for(var widget in widgets)
                {                       
                    if(widgets[widget].hasChildren())
                    {
                        subWidgets[0] = widgets[widget].getChildren();

                        for(subWidgets[1] in subWidgets[0])
                        {


                            if(subWidgets[1] == 0)
                            {
                                subWidgets[0][subWidgets[1]].dragRestriction = true;    
                                dojo.byId('output').innerHTML += subWidgets[0][subWidgets[1]].item.type + '<br>';
                                dojo.byId('output').innerHTML += subWidgets[0][subWidgets[1]].item.id + '<br>' + subWidgets[0][subWidgets[1]].dragRestriction;

                                if(subWidgets[0][subWidgets[1]].item.type == 'Device')
                                {
                                    //subWidgets[0][subWidgets[1]].dragRestriction = true;
                                    //subWidgets[0][subWidgets[1]].setSelected;
                                }                                                                       

                                for(var content in subWidgets[0][subWidgets[1]])
                                {
                                    dojo.byId('output').innerHTML += '<br>' + content;// + ' : ' + subWidgets[0][subWidgets[1]][content];                                       
                                }                                                                                   
                            }                               
                        }                                                                                                                                           
                    }

                    /*for(subWidgets[3] in widgets[widget])
                    {
                        dojo.byId('output').innerHTML += subWidgets[3] + '<br>';                                                        
                    }*/                 
                }