hi
i have a requirement which requires me add a root node and set its value which is unique from other nodes in the dynatree.
here is the code i am using to create the tree
$("#catTree").dynatree({
idPrefix: "sencat_",
debugLevel: 0,
clickFolderMode: 1,
imagePath: "images/icons/",
minExpandLevel: 2,
ajaxDefaults: {
cache: false,
dataType: "json"
},
initAjax: {
url: "../view/leaflets/PersonCategory.jsp",
mode: "all"
},
onLazyRead: function(dtnode){
dtnode.appendAjax({
url: "../view/leaflets/PersonCategory.jsp",
mode: "all"
});
},
onActivate: function(dtnode) {
oncategoryActivate(dtnode.data.key,dtnode.data.title);
}
//fx: { height: "toggle", duration: 200 },
});
and this is the process in jsp
try {
pObj = (PersonInterface)list.get("person");
m = new StringBuffer("");
sens = pObj.getPersonTypes();
if(sens.size() > 0)
{
m.append("[");
int i = 0;
for(Person s : sens)
{
String lazy = "";
i++;
if(i == 1){
m.append("{");
m.append("isFolder: true, title:\"<b>All Sensor Types</b>\"},{");
}
else
m.append(",{");
lazy = "isLazy:true,";
String name = rep(s.getName());
m.append(lazy+" isFolder: true, title:\""+name+"\", tooltip:\""+name+"\", key:\""+s.getId()+"\"}");
}
m.append("]");
}
out.println(m);
} catch (Exception e) {
e.printStackTrace();
}
now i want to add a root node to it and also set its id to 0 or -1, as all the other values will be used by this nodes created in the program..
can anyone tell me a procedure to do this.
i have tried to add the root node at the start of other nodes, but its not showing up and also not giving any error.