• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tree like select list (html)

 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a way in a servlet to generate a tree like select
list on a web page? For example:

Title 1
Title 2
Title 3

User double clicks on Title 2, tree expands to:

Title 1
Title 2
Issue 1
Issue 2
Title 3

etc... until some final action is taken?

I am new to HTML, but learning fast
i also need to be able to get the value of the check otion like issue1 etc...

thank u for helping.
 
Christian Gross
Author
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would do a search on Google: tree control JavaScript.

Here is a potential link http://www.devx.com/getHelpOn/Article/11874
 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to do that using only java and jsp code ?

is it mandatory to use javascript code ?

thankin you.
 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have found this javascript library :
http://www.javascripttoolbox.com/lib/checkboxgroup/source.php

i'm new to javascript and i want u to show me how to use the above js file in a working example.

thnx
 
Christian Gross
Author
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At first I thought, huh? What is this person asking. Then I see what is going on. Even though the examples and documentation look easy, its not!

The problem is that the documentation fails to mention that you need to create some control elements. There are examples of HTML widgets that show everything you need (http://www.dynamicdrive.com).

So let me go through the process of how I integrate the sources. When you are presented with JavaScript code in toolbox format there are two things to consider.

1) What is common
2) What is specific

If the website does its work properly then they will have split the two for you.

So in the case of the example you gave me, we first need to find what is common. The common bit is on the tab you sent as a source. So what you need to do is download the file checkboxgroup.js.

When the checkboxgroup.js file is downloaded save it to a directory on your webserver. For example if the root virtual directory is c:\root, then create a directory called c:\root\lib and move checkboxgroup.js to that directory.

Now you are ready to create an HTML page and it should look similar to the following:

<html>
<head></head>
<script language="JavaScript" type="text/javascript" src="/lib/checkboxgroup.js"></script>
<script language="JavaScript" type="text/javascript">
// Stuff to put here
</script>
<body>
<!-- HTML stuff to put here -->
</body>
</html>

In the example HTML code there are two script tags. The first script tag references the common JavaScript file you downloaded. The second script tag is used to inject the specific code. The specific code that you add is what you find when clicking on the Examples tab of the link you sent me. For the various examples there is a view/hide code button. Click on the button so that you can see the source code. Copy all of the source code.

Save the file and run it... Nothing happens right? Well, the example failed to mention that you also need to create the input checkboxes. So what you need to do is right click on the HTML page near the example and do "view page source". Then find the sample you needed to copy. Copy the associated HTML elements. Save the page, and reload the page. Now things should work better.

OK?

Christian
 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for excellent reply !

well i think i can now have some working code thanks to your help.

I still need further help about an important issue:

I have a jsp page with global variable say : <%! String str;%>

now i have in this same jsp page some javascript code...and i want to be able to read the str jsp variable into javascript variable.
is that possible ?
how can we do it ?

thnking you
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basic idea:



Eric
 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guys my javascript knowledge is very basic and i need your help:

below is a javascript code , but it doesn't work when i use a for loop.

i'm wondering how can i dynamicaly fill the tree using a loop for branches and leafs.

thankin you.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic