Solved

Javascript Menu

Posted on 2014-04-08
6
198 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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can't get js include to work in html file 8 20
Html form and modal / img src -problem 3 30
Insert Button on a table 16 38
Do alert on select 6 14
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The viewer will learn how to count occurrences of each item in an array.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

860 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