Filling cells inside grid

Hello,
Is there way to set some background for special cells in grid ?
Thanks.
Alex.

If you are talking about a Panel of type Table, then you can add a Shape that stretches to fill the cell:

    $(go.Shape, { row: 0, column: 2, stretch: go.GraphObject.Fill, fill: "cyan", strokeWidth: 0 }),

Be sure to put such Shapes first, which will render behind any other objects that might go in the cell.

For whole rows or whole columns, you can set RowColumnDefinition.background, as shown in http://gojs.net/latest/intro/tablePanels.html:

    $(go.RowColumnDefinition, { row: 2, background: 'lightblue' }),

Oh, if you are talking about Diagram.grid, a Grid Panel, as shown in http://gojs.net/latest/intro/grids.html, then you’ll want to create an unbound Part consisting of a single Shape. You’ll need to assign the Part.position and the Shape.desiredSize yourself.

Choose the Part class instead of the Node class to avoid automatically being considered as a node in the graph to be laid out by a Layout and other things that deal with “nodes”.

Put the Part in the “Grid” Layer:
{ layerName: "Grid" }
so that it isn’t selectable or pickable and so that it is always behind all of the Nodes and Links.

Yes, I’m talking about Diagram.grid.
I have some datasource and need to project this datasource on the grid, i. e. set background for some cells.
Could you describe a bit more details how to do that ?

Thanks a lot for helping.
Alex.

Take a look at the implementation of [EDIT: obsolete]

That sample does not put the Parts in the “Grid” Layer, because they are meant to be selectable. But you can either set Part.selectable and GraphObject.pickable to false on the Part, or you can put those Parts in a Layer with Layer.allowSelect and Layer.pickable are set to false.

Remember that the Diagram.grid is an infinite grid, so there’s no numbering of rows or columns.

ok, got it.
Thanks a lot!