Treelist: Add possibility to not reset selection on reset()

pull/6669/head
Aleksander Machniak 6 years ago
parent 3c760092a0
commit 743794f1d8

@ -517,8 +517,9 @@ function rcube_treelist_widget(node, p)
/** /**
* *
*/ */
function reset(keep_content) function reset(keep_content, keep_selection)
{ {
if (!keep_selection)
select(''); select('');
data = []; data = [];
@ -544,7 +545,7 @@ function rcube_treelist_widget(node, p)
container.html(''); container.html('');
} }
reset_search(); reset_search(keep_selection);
} }
/** /**
@ -609,7 +610,7 @@ function rcube_treelist_widget(node, p)
/** /**
* *
*/ */
function reset_search() function reset_search(nosel)
{ {
if (searchfield) if (searchfield)
searchfield.val(''); searchfield.val('');
@ -622,7 +623,7 @@ function rcube_treelist_widget(node, p)
me.triggerEvent('search', { query: false, last: last_search }); me.triggerEvent('search', { query: false, last: last_search });
last_search = ''; last_search = '';
if (selection) if (selection && !nosel)
select(selection); select(selection);
} }

Loading…
Cancel
Save