hummingbird-dev / hummingbird-treeview

A powerful and fast jQuery treeview plugin
MIT License
62 stars 23 forks source link

How to get node object from event ? #5

Closed GDesclaux closed 6 years ago

GDesclaux commented 6 years ago

Hi,

How to retrieve direct node object reference to the changed nodes only ?

With that :

//initial state $old = []; $("#treeview").hummingbird("getChecked", {attr:"id", list:old, onlyEndNodes:true});

//event $("#treeview").on("CheckUncheckDone", function(){ var current = []; $("#treeview").hummingbird("getChecked", {attr:"data-index", list:current, onlyEndNodes:true}); var listAdd = $(current).not(old).get(); var listRemove = $(old).not(current).get(); if (listAdd.length > 0) { $.each( listAdd, function( key, value ) { ... }); } if (listRemove.length > 0) { $.each( listRemove, function( key, value ) { ... }); } old = current; });

Is there a better way to do that ? Methods to access directly the nodes changed ?

Thanks