Solved

Javascript Menu

Posted on 2014-04-08
6
194 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Include css using javascript/jquery in html 1 49
Need to learn promise API 2 28
C3-->D3 Line Chart 4 18
Bootstap Icons 3 21
Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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)

758 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

20 Experts available now in Live!

Get 1:1 Help Now