Select to view content in your preferred language

Change the layout of cluster popup action buttons

391
2
Jump to solution
06-27-2023 06:18 AM
OlivierLefevre
Occasional Contributor

Hi,

In a code like this one is there any possiblity to change the layout of the action buttons like in the picture below ?

change order of cluster popup action buttons.jpg

 

 

 

1 Solution

Accepted Solutions
OlivierLefevre
Occasional Contributor

For those of you interested in this feature, you may find a solution here.

View solution in original post

0 Kudos
2 Replies
OlivierLefevre
Occasional Contributor

Anyone to tell me if it's possible or not please ?

If it's not I will post in JavaScript Maps SDK Ideas section.

I tried with the code below but it does not work.

 

reactiveUtils.when(
          () => view.popup?.viewModel?.active,
          //() => view.popup?.viewModel?.visible,
          () => {
            if (view.popup.selectedFeature.isAggregate) {
                
                const allActions = view.popup.viewModel.allActions.clone();
                
                const browseAction = allActions.at(4);
                allActions.reorder(browseAction, 0);
                
                const convexHullAction = allActions.at(2);
                allActions.reorder(convexHullAction, 4);
                
                const statisticsAction = allActions.at(1);
                allActions.reorder(statisticsAction, 2);
                
                //allActions.forEach((action) => console.log(action.id));

                view.popup.actions.removeAll(); // DOES NOT WORK BECAUSE actions PROPERTY IS ALREADY EMPTY
                //view.popup.selectedFeature.layer.popupTemplate.actions.removeAll();
                
                //view.popup.viewModel.overwriteActions = true;
                //view.popup.viewModel.includeDefaultActions = false;
                
                view.popup.actions = allActions; // ACTIONS ARE DUPLICATED. WHAT IS WORSE IS THAT THEY DUPLICATE EVERY TIME POPUP IS ACTIVATED BECAUSE OF reactiveUtils.when(() => view.popup?.viewModel?.active, ...)
                //view.popup.selectedFeature.layer.popupTemplate.actions = allActions;
            }
          }
        );

 

0 Kudos
OlivierLefevre
Occasional Contributor

For those of you interested in this feature, you may find a solution here.

0 Kudos