Binding goJS Layers to Grid via Knockout ObservableArray

Is there an example that shows how to bind an iterator to a knockout observable array?
Would this work anyway with the diagram.layers iterator being read only?

A few years ago I tried integrating models with Knockout observables, but I didn’t like the result. I vaguely remember that there were problems with undo/redo because I couldn’t get any “previous” value for any properties or any collection change details. (Or maybe that was with some other framework, I can’t remember.)

You are right though – even ignoring Knockout, there’s no support in GoJS for automatically maintaining the Layers in a Diagram from information in a model. You’d have to add properties in the Model.modelData, or as direct properties on the model, or as properties outside of the model. The first case is probably easiest if you are using Model.toJson and Model.fromJson.

So you’ll need to scan that array (either JavaScript Array or ObservableArray) to find differences, and add/change/remove Layers in the Diagram accordingly.

By the way, what “Grid” are you talking about?

OK thanks, that’s what I figured.
I have been playing with the devextreme components.