jerosoler / Drawflow

Simple flow library 🖥️🖱️
https://jerosoler.github.io/Drawflow/
MIT License
4.53k stars 717 forks source link

Export Button #83

Closed neha291994 closed 3 years ago

neha291994 commented 3 years ago

Where is the generated JSON file is downloaded ?

jerosoler commented 3 years ago

Hello @neha291994

There is no exists export button by default.

The export function returns an object. You can do whatever you want with it (Download, send by get or post, display on screen, save to variable).

var exportdata = editor.export();
console.log(exportdata)

For example in demo https://jerosoler.github.io/Drawflow/ show info popup.

Jero

neha291994 commented 3 years ago

Thank you for the response. It worked a for me.

can you please help in import a json file .I'm trying to call import function with the desired json data.Its doing nothing.

jerosoler commented 3 years ago

Hello, @neha291994

How are you trying to import it? Did you get an error in the Javascript console?

neha291994 commented 3 years ago

First with export saved in database .and then importing it .

No error shown in console if i pass the export function data(json data ) to import function .

jerosoler commented 3 years ago

Print in console your jsondata before import.

neha291994 commented 3 years ago

it's showing jsondata in console.

jerosoler commented 3 years ago

Compare how the data is displayed in the javascript console.

const data = editor.export (); console.log (data);

and your import data. console.log (jsondata);

is different? Is it displayed differently?

Pass image of the two data.

neha291994 commented 3 years ago

If this const data = editor.export () or the data with correct json data format is passed to import function, does it will generate the flowchart automatically ?

or i need to add some additional functionality?

jerosoler commented 3 years ago

@neha291994

Simple:

var exportdata = editor.export();
editor.import(exportdata);

View example: Download and change src from javascript and style. Or clone repository and run with npm run dev.

https://github.com/jerosoler/Drawflow/blob/master/test.html

Click button "Export"

Remove element.

And click "ImportFromExport"

neha291994 commented 3 years ago

ok thanks a lot for the response.