We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
storing node and connection data to local storage
const nodes = editor.getNodes(); const nodesString = JSON.stringify(nodes); const connections = JSON.stringify(editor.getConnections());
importing stored node and connection from local storage
const storedNodesString = localStorage.getItem('nodesData'); const connectionDetails = localStorage.getItem('connectionData'); async function importForParent(nodes: any[], parent = undefined) { const ctnodes = nodes.filter(node => node.parent === parent) for (const node of ctnodes) { await editor.addNode(node) await importForParent(nodes, node.id) } } async function importConnection(data: any[]) { const connections = data; for (const c of connections) { const source = editor.getNode(c.source); const target = editor.getNode(c.target); if ( source && target && (source.outputs as any)[c.sourceOutput] && (target.inputs as any)[c.targetInput] ) { const conn = new Connection( source, c.sourceOutput as never, target, c.targetInput as never ); await editor.addConnection(conn); } } } if (storedNodesString !== null) { const storedNodes = JSON.parse(storedNodesString); await importForParent(storedNodes) } else { await editor.addNode(startNode); await editor.addNode(endNode); } if(connectionDetails !== null) { const nodeconnection = JSON.parse(connectionDetails); await importConnection(nodeconnection); }
class AddNode extends Classic.Node implements DataflowNode { width = 209; height = 315; constructor(private customService: CustomDropdownService) { super('Processing Setup'); this.addInput('a', new Classic.Input(socket, 'connect')); this.addOutput('b', new Classic.Output(socket, 'Success')); this.addOutput('value', new Classic.Output(socket, 'Failed')); this.addControl('CustomLinkControl', new CustomLinkControl()); this.addControl('CustomDropDownControl', new CustomDropDownControl(customService)); this.addControl('CustomMultilineTextControl', new CustomMultilineTextControl()); } data() { return {}; } }
this is my node here CustomDropDownControl is not rendering when i am importing from json
No response
i have a custom drop down and Link Control but when am importing from JSON it renders default input control but i want it to render my custom controls
rete - 2.0.1
The text was updated successfully, but these errors were encountered:
editor.addNode should accept AddNode instance. Instead, it receives JSON object
editor.addNode
AddNode
Sorry, something went wrong.
Thanks that worked but how to set value to each control.
async function importForParent(nodes: any[], parent = undefined) { const ctnodes = nodes.filter(node => node.parent === parent) for (const node of ctnodes) { if (node.label =='Processing Setup') { var addNode = new AddNode(customDropdownService); addNode.id = node.id; addNode.label = node.label; await editor.addNode(addNode) } else await editor.addNode(node) await importForParent(nodes, node.id) } }
It depends on the implementation of your control class
No branches or pull requests
Describe the bug
storing node and connection data to local storage
importing stored node and connection from local storage
this is my node here CustomDropDownControl is not rendering when i am importing from json
Example to reproduce
No response
How to reproduce
Expected behavior
i have a custom drop down and Link Control but when am importing from JSON it renders default input control but i want it to render my custom controls
Dependencies
rete - 2.0.1
Platform
No response
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: