Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Binding category to shape fill colour. Undo doesn't work visually

$
0
0

@ebett wrote:

GoJS v1.7.11 - Chrome

I need to change the category value dinamically.

The code:

diagram.startTransaction('changing state: ' + node.data.text);
model.setDataProperty(node.data, 'category', 'stateInitial');
diagram.commitTransaction('changing state: ' + node.data.text);

Node Template:

$(go.Shape, 'RoundedRectangle',
    { stroke: null , strokeWidth: 0 },
    new go.Binding("fill", "category", function(category){

         if( category == 'stateInitial'){
              return '#99AE3B';
          }
          else if(category == 'stateFinal'){
              return '#E53935';
          }
          return '#6699CC';
      })
    ), . . .

This works OK, the node change its colour dinamcally.

But, After doing this:
diagram.undoManager.undo();

The node switch to previous category in the model (this is OK) but I don't see the change of colour back to the previous colour. Only diagram.rebuildParts() method works, but I can't use it.

Any idea?

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles