Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Mar 04, 2008 09:16
open dhtmlx forum
Tree: How to specify the type of inserted node

Is there a way to return the type of the node inserted with the dataprocessor? I tried the following two versions, but their userdata/type is not recognized.


--- version 1:

<?xml version="1.0" encoding="UTF-8"?>

<data>

<action type="insert" sid="99" tid="210">

<userdata name="type">myType</userdata>

</action>

</data>


--- version 2:

<?xml version="1.0" encoding="UTF-8"?>

<data>

<action type="insert" sid="99" tid="210"/>

<userdata name="type">myType</userdata>

</data>
Answer posted on Mar 05, 2008 01:01
The dataprocessor doesn't update any info except ID, but you can  attach custom code which do any additional work

<action type="insert" sid="99" tid="210" nodetype="myType">
</action>

mydataproc.defineAction("insert",function(node){
    //this code will be called after each insert callback
    var type=node.getAttribute("myType");
    if (type)
       mygrid.setUserData(node.getAttribute("sid"),"type",type);

    return true;
})