Link to home
Start Free TrialLog in
Avatar of CodingExperts
CodingExperts

asked on

How to make a dynamic tree control.

Hi all,
I want to make a dynamic checkbox tree control . The requirement is basically to show the files on my file system with a feature to check and uncheck the checkboxes depending whether i want to include these file to create a zip file.
Now the problem is that i am able to create a tree control but the parent-child relationship between the nodes has really not been possible. That is once i click on the parent item all it's children should appear clicked and in the same way once i click a child it's corresponding parent should appear checked and if all child nodes are unchecked the parent node should be unchecked if previously checked.I have tried my hands on few DHTML stuff but it really doesnot work in Netscape, and moreover i need a dynamic tree which is not possible using the example below.

Please see the link:
http://www.screenbooks.net/jorr/js/checktree.htm
ASKER CERTIFIED SOLUTION
Avatar of MogalManic
MogalManic
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Why the C grade?

Did you end up using one of my solutions?


Did you have any further questions?
Avatar of CodingExperts
CodingExperts

ASKER

HI MogalManic,
It was a good effort but my problem still persists. I don't want to go to the server side to do the processing.
When you say
>show the files on my file system
you mean the browsers file system.  If so, try these links:
https://www.experts-exchange.com/questions/21110329/File-Listing-of-Local-Drive.html

If your problem is with zipping the files, I have no idea.

If your problem is setting up the parent/child relationships, then send me some code snippits on how you are implementing this and maybe I can help!?!?
Okay MogalManic,

I am able to browse the file system on the server. My page shows a tree view of the files in any desired location on the server with all the node having a checkbox in front of it which basically does nothing but allows you to select a particular file to be included in the zip with all the other selected file of the tree view.

I want to have a parent-child relationship with the checkboxesin the tree view. If i select all files/folders within a folder then that parent folder should be automatically checked, similarly if i check the parent folder all the files/folder within the file in the treeview should be checked. Wee I can do this if I submit my page on every click which is what i am trying to avoid.

Thanks Buddy for your extended help. :-)
CodingExpert

Hey I closed the question lest i forget it ,and since u were the only one who answered i thought to award the points to u.Please don't mind if I awarded you a C Grade.
This should be doable in Javascript.  Just put an onclick event on each checkbox.  When all of the children are selected, select the parent in the Javascript.  As for the parent node selecting the children, this SHOULD be already happening.  At least it does in the demo application you supplied.  If you are having trouble with the Javascript, post a new question in the JavaScript forum (I suppose it is doable in VBScript too).

As for the points, I don't care(It's only points, not like I'm getting paid), but if I answered the question better, maybe the moderator can raise the grade.
Hi MogalManic

The problem is that since the checkboxes are dynamically generated so are their names.
  chk1
       -- chk1_1
       -- chk1_2
   chk2
       -- chk2_1
           -- chk2_1_1
           -- chk2_1_2
                --chk2_1_2_1
and so on so how can i write a javascript to establish parent child relationship !!!!