Hi,
Hi,
Sorry to bother you again, first thing I am new to javascript (just 4 months) and just started with jquery with your jstree before that i was using dojo library there dojo tree is third class, that's why i used yours and is awesome, I will just explain you what I am trying to do here first thing everything is dynamic here noting is static
I am using your jstree with arcgis server javascript api, I am populating some point data on the map and some combination of points represents a territory with a color(so the number of territories depends upon user login means each user have different number and color territories) so every thing here is dynamic.
Before using your jstree what i was doing:-
I was you simple using css3 to populate legend for the map because before each user was having less than 3 territories so max three legend easily manageble
So my code was
My css:-
1) #legend { left: 5px; bottom: 5px; position: absolute; height: 125px; width: 125px; background-color: #FFFFFF; opacity: 0.85;border-radius: 7px; z-index: 50; padding: 1em; font-size: 0.85em; }
2) #circle3 { height: 20px; position: relative; width: 20px;}
3) .circle { border-radius: 50%; display: inline-block; margin-right:5px;}
My JS Code:-
var classbreaks = [{r:143, g:30, b:5, legendLabel:"Winston Salem"}, {r:160, g:25, b:92, legendLabel:"Charlotte"}, {r:28, g:19, b:24, legendLabel:"Fayetteville"}] //here this json us generated dynamically while generating random colors for territories(I have a code for generaring random colors) but for now i am showing you as a static joson
function generatelegend(classbreak) {
classbreaks.forEach( function (classbreak, i) {
domConstruct.create("div", {
innerHTML:'<table><tr><td> <div id="circle3" class="circle" style="background: rgb(' + classbreak.r + ',' + classbreak.g + ',' + classbreak.b + ');") ></div></td>' +
'<td><span style="vertical-align: top;"><b>' + classbreak.legendLabel + '</b></span></td></tr></table>'
}, 'legend');
}}
HTML Code
<div id="legend" style="position: relative;float: left;margin-bottom: -45%;margin-top: 32%;">
<div id="header">Legends</div>
<hr/>
</div>
I have attached a .jpg for above thing
But now I have more than 25 territories for a user and it is not possible to show legend so big that's why i have used your jstree as a Table of content and I am almost successful with it. Just that dynamic legend generation thing is not working your tree 'icon :' attribute thing.
here i am making dynamic json for your tree to populate according to the no of territories using parent and child thing
I stored as data, and on hover I retrieved it as function (e, data ){ var data = data.node.data}, but on node right click context menu if I click on one of the option of context menu(to which I have attached a function)I want same data , but I was not able to get it.
Regards