Skip to content

Commit

Permalink
Add in_selection() to rcube_treelist_widget
Browse files Browse the repository at this point in the history
So code working on all lists doesn't have to check widget type
to work with selection.
  • Loading branch information
alecpl committed May 20, 2019
1 parent 4bce2c4 commit d646a10
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions program/js/treelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function rcube_treelist_widget(node, p)
this.get_item = get_item;
this.get_node = get_node;
this.get_selection = get_selection;
this.in_selection = in_selection;
this.get_next = get_next;
this.get_prev = get_prev;
this.get_single_selection = get_selection;
Expand Down Expand Up @@ -295,6 +296,15 @@ function rcube_treelist_widget(node, p)
return selection;
}

/**
* Check if given id is selected
* This is for consistency with rcube_list_widget
*/
function in_selection(id)
{
return selection == id;
}

/**
* Return the DOM element of the list item with the given ID
*/
Expand Down

0 comments on commit d646a10

Please sign in to comment.