Solved

Javascript Menu

Posted on 2014-04-08
6
200 Views
Last Modified: 2014-04-10
Hi there,

Can you please have me out here, I've have done folder tree using JavaScript & JQuery.Now I want to use that tree structure in one page three times (three cols) for different sales units.Please have a look the attachement.  Any idea please?

Regards
folder-tree-dummy.png
0
Comment
Question by:adnankh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 

Author Comment

by:adnankh
ID: 39987920
Please give any idea,, I've attached the scripts as well.
Demo.js Code:
$(document).ready(function(){
		
	// first example
	$("#navigation").treeview({
		collapsed: true,
		unique: true,
		persist: "location"
	});

	
	// second example
	$("#browser").treeview({
		animated:"normal",
		persist: "cookie"
	});

	$("#samplebutton").click(function(){
		var branches = $("<li><span class='folder'>New Sublist</span><ul>" + 
			"<li><span class='file'>Item1</span></li>" + 
			"<li><span class='file'>Item2</span></li></ul></li>").appendTo("#browser");
		$("#browser").treeview({
			add: branches
			});
	});


	// third example
	$("#red").treeview({
		animated: "fast",
		collapsed: true,
		control: "#treecontrol"
	});


});

Open in new window


<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
	<title>Greater China</title>
	<link rel="stylesheet" href="../jquery.treeview.css" />
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
	<script src="../lib/jquery.cookie.js" type="text/javascript"></script>
	<script src="../jquery.treeview.js" type="text/javascript"></script>
	<script type="text/javascript" src="demo.js"></script>
</head>

<body>
<h3>Financial Analysis</h3>
 <ul id="browser" class="filetree">
		<li><span class="folder">Finance Reports</span>
    <ul>
				<li><span class="folder">General Accounting </span>
						<ul id="folder21">
						<li><span class="file">Balance Sheet</span></li>
						<li><span class="file">P & L</span></li>
		</ul>
		</li>
    
		<li><span class="folder">Accounts Payable </span>
					<ul id="folder21">
						<li><span class="file">Balance Sheet</span></li>
						<li><span class="file">Cash Flow</span></li>
						<li><span class="file">Profit & Loss</span></li>
					</ul>
				</li>
     
		 <li><span class="folder">Fixed Assets </span>
					<ul id="folder21">
						<li><span class="file">Asset Register Report</span></li>
						<li><span class="file">Asset Register Report Two</span></li>
					</ul>
				</li> 
				</ul>
			 
		</li>
		<li><span class="folder">Finance Analysis</span>
			<ul>
				<li><span class="folder">Regional Reports</span>
					<ul id="folder21">
						<li><span class="file">CF - Current Year Actual Trading</span></li>
						<li><span class="file">CF - Current Year Period</span></li>
						<li><span class="file">MCB - Current Year Actual Trading</span></li>
						<li><span class="file">MCB - Current Year Period</span></li>
						<li><span class="file">OCOS - Current Year Actual Trading</span></li>
						<li><span class="file">OCOS - Current Year Period</span></li>
					</ul>
				</li>
        
				<li><span class="folder">MOR</span>
					<ul id="folder21">
						<li><span class="file">MOR CF By Current Period</span></li>
						<li><span class="file">MOR MCB By Current Period</span></li>
					</ul>
				</li>
        <li><span class="folder">Other Region</span>
					<ul id="folder21">
						<li><span class="file">Other Region Report-1</span></li>
						<li><span class="file">Other Region Report-2</span></li>
					</ul>
				</li>
				</ul>
		</li>
		<li class="closed"><span class="folder">Misc Finance Reports</span>
			<ul>
				<li><span class="file">More Reports-1</span></li>
				<li><span class="file">More Reports-2</span></li>
			</ul>
		</li>
		<li><span class="file">More Reporting Coming</span></li>
	</ul>

<h3>Financial Analysis</h3>
<ul id="browser1" class="filetree">
		<li><span class="folder">Finance Reports</span>
    <ul>
				<li><span class="folder">General Accounting </span>
						<ul id="folder21">
						<li><span class="file">Balance Sheet</span></li>
						<li><span class="file">P & L</span></li>
		</ul>
		</li>
    
		<li><span class="folder">Accounts Payable </span>
					<ul id="folder21">
						<li><span class="file">Balance Sheet</span></li>
						<li><span class="file">Cash Flow</span></li>
						<li><span class="file">Profit & Loss</span></li>
					</ul>
				</li>
     
		 <li><span class="folder">Fixed Assets </span>
					<ul id="folder21">
						<li><span class="file">Asset Register Report</span></li>
						<li><span class="file">Asset Register Report Two</span></li>
					</ul>
				</li> 
				
			</ul>
			
      
		</li>
		<li><span class="folder">Finance Analysis</span>
			<ul>
				<li><span class="folder">Regional Reports</span>
					<ul id="folder21">
						<li><span class="file">CF - Current Year Actual Trading</span></li>
						<li><span class="file">CF - Current Year Period</span></li>
						<li><span class="file">MCB - Current Year Actual Trading</span></li>
						<li><span class="file">MCB - Current Year Period</span></li>
						<li><span class="file">OCOS - Current Year Actual Trading</span></li>
						<li><span class="file">OCOS - Current Year Period</span></li>
					</ul>
				</li>
        
				<li><span class="folder">MOR</span>
					<ul id="folder21">
						<li><span class="file">MOR CF By Current Period</span></li>
						<li><span class="file">MOR MCB By Current Period</span></li>
					</ul>
				</li>
        <li><span class="folder">Other Region</span>
					<ul id="folder21">
						<li><span class="file">Other Region Report-1</span></li>
						<li><span class="file">Other Region Report-2</span></li>
					</ul>
				</li>
				</ul>
		</li>
		<li class="closed"><span class="folder">Misc Finance Reports</span>
			<ul>
				<li><span class="file">More Reports-1</span></li>
				<li><span class="file">More Reports-2</span></li>
			</ul>
		</li>
		<li><span class="file">More Reporting Coming</span></li>
	</ul>



<h3>Financial Analysis</h3>
<ul id="browser2" class="filetree">
		<li><span class="folder">Finance Reports</span>
    <ul>
				<li><span class="folder">General Accounting </span>
						<ul id="folder21">
						<li><span class="file">Balance Sheet</span></li>
						<li><span class="file">P & L</span></li>
		</ul>
		</li>
    
		<li><span class="folder">Accounts Payable </span>
					<ul id="folder21">
						<li><span class="file">Balance Sheet</span></li>
						<li><span class="file">Cash Flow</span></li>
						<li><span class="file">Profit & Loss</span></li>
					</ul>
				</li>
     
		 <li><span class="folder">Fixed Assets </span>
					<ul id="folder21">
						<li><span class="file">Asset Register Report</span></li>
						<li><span class="file">Asset Register Report Two</span></li>
					</ul>
				</li> 
				
			</ul>
			
      
		</li>
		<li><span class="folder">Finance Analysis</span>
			<ul>
				<li><span class="folder">Regional Reports</span>
					<ul id="folder21">
						<li><span class="file">CF - Current Year Actual Trading</span></li>
						<li><span class="file">CF - Current Year Period</span></li>
						<li><span class="file">MCB - Current Year Actual Trading</span></li>
						<li><span class="file">MCB - Current Year Period</span></li>
						<li><span class="file">OCOS - Current Year Actual Trading</span></li>
						<li><span class="file">OCOS - Current Year Period</span></li>
					</ul>
				</li>
        
				<li><span class="folder">MOR</span>
					<ul id="folder21">
						<li><span class="file">MOR CF By Current Period</span></li>
						<li><span class="file">MOR MCB By Current Period</span></li>
					</ul>
				</li>
        <li><span class="folder">Other Region</span>
					<ul id="folder21">
						<li><span class="file">Other Region Report-1</span></li>
						<li><span class="file">Other Region Report-2</span></li>
					</ul>
				</li>
				</ul>
		</li>
		<li class="closed"><span class="folder">Misc Finance Reports</span>
			<ul>
				<li><span class="file">More Reports-1</span></li>
				<li><span class="file">More Reports-2</span></li>
			</ul>
		</li>
		<li><span class="file">More Reporting Coming</span></li>
	</ul>
</body>

Open in new window


Thank you,
0
 
LVL 5

Expert Comment

by:jayakrishnabh
ID: 39988443
create a plugin for the tree structure you created and use it any number of times in a page.
0
 

Author Comment

by:adnankh
ID: 39990429
Hi Jaya,

I can't get it.. how I can get this done? Please advise more, as I'm not a Developer..

Kind Regards,
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:adnankh
ID: 39990468
Jaya I have done this..only what I want now to all these three tree place next to each other...i.e. say tabular form.. so please advise... Thanks
0
 

Author Comment

by:adnankh
ID: 39990564
Jaya I've attached my output ..all three folder structure I want next to each other, like parallel..please advise..
folder-tree-vertical.png
0
 
LVL 5

Accepted Solution

by:
jayakrishnabh earned 500 total points
ID: 39990819
Add the Treeview plugin(js file) to your project. Reference it in your web page.
To create 3 treeviews , create three divs and name them (say div1, div2, div3)
Now, on document load , please call the addtree method of plugin for the divs to which treeview has to be added.

Sample code is given below.

<script src="TreeViewPlugin.js"></script>

<div id='div1'></div>
        <div id='div2'></div>
        <div id='div3'></div>
    <script>
        $(document).ready(function () {
            $("#div1").addtree();
            $("#div2").addtree();
            $("#div3").addtree();
        });
    </script>
TreeViewPlugin.js
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

689 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question