Solved

Javascript Menu

Posted on 2014-04-08
6
195 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
  • 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now