We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

Is it possible for me to define a name when saving the file?

Resolved
Luciano Carvalho asked on February 20, 2018

When I click the Save button, it already saves it with the name "report.json", is there any way to appear an input for the user to set this name before saving?
I wait, hugs!

3 answers

Public
Psyala February 21, 2018

You can override the handler for the save button in the toolbar by utilising the following pivot property:

beforetoolbarcreated

Then you can override the save tab's handler with a function like so:

//inside function for beforetoolbarcreated:
let saveTab = tabs[2];
saveTab.handler = customSaveFunction;

//save function:
function customSaveFunction() {
    this.pivot.save({
      filename: "myfile.json"
  });
}

I've made a JSFiddle example: http://jsfiddle.net/odteu83q/7/

Public
Psyala February 21, 2018

Just a follow up, within the customSaveFunction() you can have your code that prompts the user to enter their own filename.

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster February 21, 2018

Hello
We are glad that the question seems to be resolved. Thank you for your participation Psyala. 
Luciano, please let us know if everything works fine for you.
Regards,
Dmytro

Please login or Register to Submit Answer