Skip to content

Commit

Permalink
check if onSelectionChanged exists
Browse files Browse the repository at this point in the history
  • Loading branch information
novikov82 committed May 31, 2024
1 parent 9eaa13e commit 2395261
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/actions/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ export function createDropdownActionModelAdvanced(actionOptions: IAction, listOp
const originalSelectionChanged = listOptions.onSelectionChanged;
listOptions.onSelectionChanged = (item: Action, ...params: any[]) => {
if (newAction.hasTitle) { newAction.title = item.title; }
originalSelectionChanged(item, params);
if (originalSelectionChanged) {
originalSelectionChanged(item, params);
}
};
const popupModel: PopupModel = createPopupModelWithListModel(listOptions, popupOptions);

Expand All @@ -192,7 +194,9 @@ export function createDropdownActionModelAdvanced(actionOptions: IAction, listOp
export function createPopupModelWithListModel(listOptions: IListModel, popupOptions: IPopupOptionsBase): PopupModel {
const listModel: ListModel = new ListModel(listOptions as any);
listModel.onSelectionChanged = (item: Action) => {
listOptions.onSelectionChanged(item);
if (listOptions.onSelectionChanged) {
listOptions.onSelectionChanged(item);
}
popupModel.hide();
};

Expand Down

0 comments on commit 2395261

Please sign in to comment.