| QUERIES | RESPONSE |
| But it looks too lengthy to define addinfo in each of the node one by one. I was thinking if we do not initialize any addinfo in nodes or in diagrams. | Instead of initializing nodes addInfo property for each node, you can initialize addInfo property for nodes using model default settings node property , So that it applies for all the nodes in diagram. Code Sample: $("#diagram").ejDiagram({ width: "700px", height: "700px", nodes: nodes, itemClick: diagramClick, defaultSettings: { node: { addInfo:{ fill:["black","black"], fontSize:[12,12] }} }, pageSettings: { scrollLimit: "diagram" }, }); Sample: <text fill={{:addInfo.fill[0]}} transform="matrix(1 0 0 1 156.6821 149.2686)" font-family="'GothamBold'" font-size={{:addInfo.fontSize[0]}}>New Apply</text> <text fill={{:addInfo.fill[1]}} transform="matrix(1 0 0 1 136.6821 49.2686)" font-family="'GothamBold'" font-size={{:addInfo.fontSize[1]}}>APPLY NOW</text> |
| when user drag any node from symbol palette to diagram at that time when node is clicked then we initialize or addinfo for that node only. not for all the nodes which are available in symbol palette collection. Is it possible? | Yes. when node is clicked , you can use itemClick event in which you can update node appearance by using updateNode method. Code Sample: $("#diagram").ejDiagram({ width: "700px", height: "700px", nodes: nodes, itemClick: diagramClick, defaultSettings: { node: { addInfo:{ fill:["black","black"], fontSize:[12,12] }} }, pageSettings: { scrollLimit: "diagram" }, }); Method: function diagramClick(args){ var diagram = $("#diagram").ejDiagram("instance"); if (args.element) { var node = args.element; if (node.addInfo) { //update node template at runtime diagram.updateNode(node.name, { templateId: "svgTemplate", addInfo:{fill : ["red","orange"], fontSize:[40,40]}}); } } } |