Skip to content

Commit

Permalink
Introduce event selection-start
Browse files Browse the repository at this point in the history
This is triggered once, when a new selection starts
  • Loading branch information
sukhwinder33445 committed Jul 4, 2024
1 parent e3fa5a8 commit d2ff9b4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions asset/js/widget/ActionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ define(["../notjQuery"], function (notjQuery) {
if (activeItems.length === 1
&& toActiveItems.length === 0
) {
notjQuery(this.list).trigger('all-deselected', {target: target, actionList: this});
notjQuery(this.list).trigger(
'all-deselected',
{target: target, actionListItem: activeItems[0]}
);

this.clearSelection(toDeactivateItems);
this.addSelectionCountToFooter();
Expand Down Expand Up @@ -443,6 +446,13 @@ define(["../notjQuery"], function (notjQuery) {
return;
}

if (this.lastTimeoutId === null) { // trigger once, when just started selecting list items
notjQuery(this.list).trigger(
'selection-start',
{actionListItem: activeItems[0]}
);
}

clearTimeout(this.lastTimeoutId);
this.lastTimeoutId = setTimeout(() => {
this.lastTimeoutId = null;
Expand All @@ -451,7 +461,7 @@ define(["../notjQuery"], function (notjQuery) {

notjQuery(this.list).trigger(
'load-selection',
{url: url, firstActiveItem: activeItems[0]}
{url: url, actionListItem: activeItems[0]}
);
}, 250);
}
Expand Down

0 comments on commit d2ff9b4

Please sign in to comment.