I writng program in JSP.
when i try write this code dhtmlxTree show all checkboxes but it’s not check in “rc”,
can you show me any idea will be greatful ?
how to render dhtmlxTree with some of the checkboxes checked by default.
if you have some sample serializeTree() pls give me, Pattakorn E-Mail java_thai@windowslive.com
Thanks
Pattakorn
Answer posted by Stanislav (support) on Oct 07, 2009 02:23<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>
The loading is async. In above code you are calling setCheck before data is really loaded in the tree.
You need to change the code as
tree2.loadXML("…/common/tree3.xml",function(){
// executed after data loading
tree2.setCheck(“rc”,true);
});<o:p></o:p>
Thank you for Your Example.I try it and it works very good.
but my point doesn’t want to fix this code in loadXML function ,
loading checkboxes must depend on each user profile.
Ex.
After login my program must read each user profile from mySql so if
User1 login I want to show checking “rc” and “history” by default either or
User2 login I want to show checking “horror”, “fantasy” and “history” by default.
If my Point like this can you give me some Sample, I writng program in JSP..
Thanks
Pattakorn
You have two possible solution
a) specify which checkbox is set directly in xml. If you are generating xml dynamically you can place user-checking logic in that code.
<item id=“history” checked=“1” … <= such item will be loaded with checked checkbox
b) the second solution is to place jsp code directly on the page
tree2.loadXML("…/common/tree3.xml",function(){
var checked = <% some_jsp_method_which_returns_list_of_ids(); %>
checked = checked.split(",");
for (var i=0; i<checked.length; i++)
tree2.setCheck(checked[i],true);
});