get newly added section object to change style

Oct 4, 2012 at 8:40 AM

Hi,

I am getting stuck at point to get newly created object on click of addsection icon. I need this becauase i want to change style of newly created section. I obsered one thing that even addIcon onClick method trigger first then new section created in tree.

Please help me out to get newly created section object on addSecionIcon.

Is there any event so that i come to know that XXX section is added which trigger after sectioin added in tree.

Thanks,

Ganesh

Coordinator
Oct 4, 2012 at 12:35 PM

yes there are both a creating(triggered jus before) and a  created(triggered immediately after) events . See here all events supported by the treeview: http://mvccontrolstoolkit.codeplex.com/wikipage?title=Client%20Side%20Handling%20of%20Items%20Controls

Oct 4, 2012 at 3:04 PM

Hi Frank,

Thanks for replying.

In documents mention that

$('referenceNode').bind('itemChange', function (e, eventData) { ..... });
 

referenceNode selects the Html node that acts as a representative of the whole control. Any node that contains the whole control inside it can act as a reference node, since in javascripts all events are bubbled up.

In my page , the tree view control is inside one div like

<div id='trieeViewDiv'>

<TreeView.....>

</div>

and I attached event like

$('trieeViewDiv').bind('ItemCreated', function (e, eventData) { ..... });

but still tthat event is not triggering.

Please let me know any thing I made mistake here to understand the document.

 

Thanks,

Ganesh

 

 

Coordinator
Oct 4, 2012 at 5:09 PM
Edited Oct 4, 2012 at 5:11 PM

May the problem is that you forgot: #

 

$('#trieeViewDiv').bind('ItemCreated', function (e, eventData) { ..... });

Oct 5, 2012 at 8:06 AM

yes , # was there ,I missed out while typing.

But still it not triggering  the event.

Coordinator
Oct 5, 2012 at 1:22 PM

The tree in the examples shipped with the binary show the event triggering! Gives a look to the example code: BinariesWithSimpleExamples and compare with your code to understand why it is not working for you. In the example I put a css class in the root to bind the handler directly to the root, but you can modify the code by binding the event handler to the div that contains the tree and will see that the events are triggered. Play wit that examples and then copy javascript the bind instuction to your project.

Maybe the bind event doesnt work because the html has no been created yet. Have you put your code in the document ready, or in the page AFTTER the div 'treeViewDiv' is closed?