Change the color of nodes in nodeDataArray from color selecting from dropdown in html

i want to change the color of my nodes template when i select any of the color from dropdown menu appears above the diagram. how can i achieve this functionality ? there is a “color” attribute present in nodeDataArray also.

You have several choices, depending on what you might want to allow.

If you want to allow the user to change the color of some or all of the nodes, and if there is a Binding in the node template(s) with “color” as the source data property, then you could just run through the data and modify the “color” property.

myDiagram.model.commit(function(m) {
    m.nodeDataArray.forEach(function(d) {
        m.set(d, "color", newColor);

Alternatively you could use a Binding that uses the shared Model.modelData object as the data source.
Maybe something like this on one of the node template’s Shapes:

    new go.Binding("fill", "color").ofModel()

Then changing the color for all of the nodes that use that binding would be something like:

myDiagram.model.commit(function(m) {
    m.set(m.modelData, "color", newColor);

That means the “color” property would not be duplicated on each of the node data objects. This also has the advantage that if additional nodes are added to the model, the corresponding nodes would automatically use the new (shared) color.

thank you Walter… it really helps me alot.!