Hi everyone,
I’m trying to add a new export option (“Export to Tab”) that should appear inside the Map Popup’s Data Action list — alongside the existing actions such as Export CSV, Export GeoJSON, etc.
I understand that data actions can be managed via the DataActionManager class in jimu-core/lib/data-action-manager.
I attempted to register a new DataAction dynamically like this:
import { DataActionManager } from 'jimu-core';
const manager = DataActionManager.getInstance();
await manager.registerAction({
id: 'export-tab',
label: 'Export to Tab',
icon: 'export',
uri: '../data-actions/export-to-tab'
});
And my export-to-tab.ts looks like this:
import { AbstractDataAction, DataRecordSet, DataLevel } from 'jimu-core';
export default class ExportToTabAction extends AbstractDataAction {
id = 'export-tab';
label = 'Export to Tab';
icon = 'export';
async isSupported(dataSets: DataRecordSet[], dataLevel: DataLevel, widgetId: string): Promise<boolean> {
return dataSets?.length > 0;
}
async onExecute(dataSets: DataRecordSet[], dataLevel: DataLevel, widgetId: string): Promise<boolean> {
console.log('Export to Tab clicked:', dataSets);
return true;
}
}
The registration runs without any error, but my new “Export to Tab” option does not appear in the popup’s Data Action list when clicking on a feature in the map.
When I log manager.getActions(), I can see the built-in ones (like Export CSV, Export GeoJSON, etc.), but not my custom action.
Hi @ShengdiZhang , Thank you for your reply.
I have added the ActionClass instead of the URI. Now, the Export to Tab option appears in the existing Action List.
However, I want to add the Export to Tab option to the already existing Export Options instead of the general Action List.
I want to add it directly into the Export Options dropdown/panel, so that users can see it alongside the other export choices.
Could you guide me on how to integrate the ActionClass specifically into the Export Options rather than the general Actions?
Hi, when registering the action, please set the name to ‘export’.