What would be the script to show the Share context menu on a button click as describe here: Only show "Share" option in context menu
Thanks,
What would be the script to show the Share context menu on a button click as describe here: Only show "Share" option in context menu
Thanks,
Hi,
The link you posted actually has most of the sample. Specifically this part:
var commands = [];
// define new commands and push to the commands array
var parentMenuItem = new dundas.Command({
caption: "Share",
categoryName: "Share",
action: function () {
// Do cool stuff here
}.bind(this),
subCommands: [
new dundas.Command({
id: dundas.Utility.createGuid(),
caption: "PDF",
categoryName: "Export to PDF",
description: 'Export to PDF',
editModeOnly: false,
action: function () {
var share = new dundas.controls.ExportDialog(dundas.constants.STANDARD_PDF_EXPORT_PROVIDER_ID);
var sharePanel = share.show();
}.bind(this)
}),
]
});
commands.push(parentMenuItem);
The only part is missing is how to show a command once created. You can do this via:
window.dundas.context.getService("ContextMenuService").showContextMenu(commands, e.originalEvent);
The ExportDialog
takes an exportProviderId
, and the list of export provider IDs can be found in the constants for you to use.
Is there a way to also change the start position of context menu and aligned it to the button you are clicking?
Thanks!
I think I answered this in your other post here: