0

I Use Fuel UX tree plugin. And I need to get information about unselected item when mouse click. At first, all items in tree are selected, and when I click on tree item, it's become unselected, but I cannot get information about this item, because this code:

$('#tree1').on('selected', function (evt, data) {
     console.log(data);
}

returned only selected items. Are the way to get information about unselected items in tree?

Yaroslav Osetrov
  • 894
  • 1
  • 10
  • 13
  • according to the documentation, "This event is fired when item/items has been selected. An object containing {info: data} is returned. data represents an array of selected items". So I doubt there is a way for you to do this with the selected event – dcodesmith Jan 20 '14 at 10:50
  • And is there an opportunity to add html attribute/class to tree item? – Yaroslav Osetrov Jan 20 '14 at 11:24
  • I see no reason why you shouldn't be able to. – dcodesmith Jan 20 '14 at 11:29

1 Answers1

0

I added an additional "unselected" event into my copy of the fuelUX code around line 100...

if($el.hasClass('tree-selected')) {
    this.$element.trigger('unselected', {info: $el.data()});
    $el.removeClass('tree-selected');
    $el.find('i').removeClass(this.options['selected-icon']).addClass(this.options['unselected-icon']);
} else {
...

This sends me the data associated with the unselected item as well. Hope it helps you.

user2951509
  • 16
  • 1
  • 1