Opened 3 years ago

Last modified 10 months ago

#12982 new defect

GridContainer offsets column index when manually organized

Reported by: stefan_t Owned by:
Priority: high Milestone: tbd
Component: DojoX Layout Version: 1.6.1
Keywords: gridcontainer isAutoOrganized Cc:
Blocked by: Blocking:


When creating a manually organized dojox.layout.GridContainer (isAutoOrganized: false) programmatically to place widgets in specific columns the error
"Unable to insert child in GridContainer"
appears in the console for widgets placed in column 0.

It appears the addChild method assumes a zero-based column index, but the _organizeChildrenManually method assumes a one-based column and thus subtracts 1 from the column before calling _insertChild to re-arrange child widgets.

Another effect is that it's impossible to place widgets in the last column.

Example to reproduce:

dojo.addOnLoad(function() {

var cpane1 = new dijit.layout.ContentPane({ title:"cpane1", content: "Content Pane 1 : Drag Me !" }),

cpane2 = new dijit.layout.ContentPane({ title:"cpane2", content: "Content Pane 2 : Drag Me !" }),
cpane3 = new dijit.layout.ContentPane({ title:"cpane3", content: "Content Pane 3 : Drag Me !" });

var gridContainer = new dojox.layout.GridContainer({

nbZones: 3,
isAutoOrganized: false

}, dojo.byId("rootNode"));

gridContainer.addChild(cpane1, 0, 0);
gridContainer.addChild(cpane2, 1, 0);
gridContainer.addChild(cpane3, 2, 0);


Attachments (1)

GridContainerLite.js.patch (730 bytes) - added by stefan_t 3 years ago.
Patch for GridContainerLite

Download all attachments as: .zip

Change History (3)

Changed 3 years ago by stefan_t

Patch for GridContainerLite

comment:1 Changed 20 months ago by dwinkler

This bug still exists in Dojo version 1.8.0;
You can circumvent it by first starting up the GridContainer.

comment:2 Changed 10 months ago by postkassa

Patched local copy of GridContainerLite.js line 454 to be:

child.set("column", column + 1);

and on dropping in the last column the gridcontainer redrew itself correctly.
Might break something else though.

Note: See TracTickets for help on using tickets.