rete
rete copied to clipboard
Create a node for looping over code with conditions
Hello, Thanks for all the good work you are doing with rete js. We are using your library for one Drupal 8 module. And it is getting a good response. Here is the link for the module which we are working on https://www.drupal.org/project/if_then_else
We need some help with one functionality which we want to have in our module. We want a loop type of functionality that can loop over a set of nodes. We can handle the programmatic part of it but we need help with UI. We need a node that can hold a set of other nodes in it. I am attaching an image of a rough idea of what we need. Can you please help me with how I can proceed with it?
https://github.com/retejs/rete/issues/243#issuecomment-457853921
Hi, Thanks for sharing the other issue which is related to this. I did try what was given there but I think that won't work for my case. The problem is in our module we are not using retejs to do any processing. It is only used for creating a flow of events, actions, and conditions. With foreach node, I want to loop over a subset of nodes that are connected with that foreach. Now there could be multiple foreach nodes in the same graph. The problem is I am not able to make a decision programmatically, which all nodes are to be processed in foreach. So what I was thinking to have a different type of node which can hold a subset of nodes inside it and somehow in the JSON we know that which set of nodes are inside that special type of node. Can you please provide me some direction on how we can achieve that? I have attached a screenshot of what I am visualizing as what that special type of node would look. Let me know if that is possible somehow in retejs?
Thanks
@akshayred
We can handle the programmatic part of it but we need help with UI. We need a node that can hold a set of other nodes in it.
There is no implementation for this case. Maybe the plugin module will solve your problem
@Ni55aN I did check the plugin module as you suggested. Can you help me how I we can add a new node type to it. I think the current node defined there is for normal node and for the loop node we might have to define a totally new node type.
I do not know how your implementation works. I can only suggest making a loop node as in the example:https://codepen.io/Ni55aN/pen/KJVEMe
Hi , I am trying to compile rete example using gulp-babel and use the bundled file in html but I am getting error in console - "ReferenceError: require is not defined". Am I doing something wrong ??
@Ni55aN Can you help me with understanding how the current node is being generated. Is it called by the area or by editor. I am thinking to create another implementation of node which should be able to include other nodes inside it.
ReferenceError: require is not defined
It seems that gulp-babel import CommonJS dependencies and doesn't transpile them completely into iife bundle
Can you help me with understanding how the current node is being generated
rete creates HTMLElement for node
NodeEditor -> addNode -> EditorView -> addNode-> new NodeView() -> triggerrendernode` -> rete-*-render-plugin insert content into this element
I am thinking to create another implementation of node which should be able to include other nodes inside it.
I think a custom node will solve your issue
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.