Categories | Question details Back To List | ||
want to Create CheckBoxes for Each user Profile when loading data I writng program in JSP.
<script> tree2 = new dhtmlXTreeObject("treeboxbox_tree", "100%", "100%", 0); tree2.setCheck("rc",true); 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 The loading is async. In above code you are calling setCheck before data is really loaded in the tree. 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 Answer posted by Stanislav (support) on Oct 08, 2009 06:19 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. <tree> <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); }); |