How to add custom events for pivot config popup?

I would like to add my custom events for “Cancel” and “Ok” rather than the current events. How can I do that?

Hello,

There are the following events that are fired for config window on their click:

  • onCancel
  • onAppply
var win = pivot.getConfigWindow();
win.attachEvent("onCancel", function(){
   ...
});
win.attachEvent("onAppply", function(structure){
    ...
});

However, these events do not allow preventing built-in handlers.

Hello,
Thanks for the help. Is it possible to call those events using other buttons?

Hello,

“Cancel” button hides a configuration window:

pivot.getConfigWindow().hide();

To emulate “Apply” click you can do the following:

var structure = pivot.getStructure();
pivot.getConfigWindow().callEvent("onApply", [structure]);

you can also hide a window then.

Thanks once again. After making any changes in the config window how can I get the changed structure before closing the popup?

You can try the following:

var configWindow = pivot.getConfigWindow();
// get structure selected in the config window
var structure = configWindow.getStructure();
// call onApply handler
configWindow.callEvent("onApply", [structure]);
// hide the config window
configWindow.hide();