Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#4900 closed defect (fixed)

Grid does not resize with parent widgets

Reported by: Bryan Forbes Owned by: sorvell
Priority: high Milestone: 1.1
Component: DojoX Grid Version: 0.9
Keywords: Cc: alex, dylan
Blocked By: Blocking:

Description

When the grid is parented by a widget that inherits from dijit.layout._LayoutContainer, it does not resize when the parent widget resizes. Rather, you are required to use this code to get it to resize:

dojo.connect(container, "resize", grid, function() {
    grid.resize();
});

This makes using the grid as a standard widget inside container widgets a pain.

Attachments (2)

test_grid_layout_2.html (3.7 KB) - added by Bryan Forbes 12 years ago.
test_grid_layout_3.html (2.6 KB) - added by guest 12 years ago.
Test case for invalid sizing of grid

Download all attachments as: .zip

Change History (16)

comment:1 Changed 12 years ago by alex

Owner: changed from sorvell to alex
Status: newassigned

comment:2 Changed 12 years ago by alex

Cc: alex dylan added
Resolution: invalid
Status: assignedclosed

this bug appears to be somewhat inaccurate. See http://dojotoolkit.org/~alex/anon_view/dojox/grid/tests/test_grid_layout.html

If not parented by a ContentPane? (a known resize() event black-hole), resize events are correctly cascaded.

Marking "invalid".

comment:3 Changed 12 years ago by Bryan Forbes

Resolution: invalid
Status: closedreopened

Reopening and adding a test. This test is exactly like test_grid_layout.html except the bottom container is a dijit.layout.LayoutContainer?. If you move the split up, you'll notice that the bottom grid does not resize.

Changed 12 years ago by Bryan Forbes

Attachment: test_grid_layout_2.html added

comment:4 Changed 12 years ago by bill

Bryan, this looks wrong:

<div id="bottomRight" dojoType="dijit.layout.LayoutContainer" sizeMin="20" sizeShare="30">
             <div id="grid3" dojoType="dojox.Grid" model="model" structure="layout2"></div>
</div>

You can probably just get rid of the LayoutContainer? and make the Grid a child of the LayoutContainer?'s parent.

comment:5 Changed 12 years ago by bill

Resolution: invalid
Status: reopenedclosed

Marking invalid; feel free to reopen with a valid testcase, as per my advice above.

comment:6 in reply to:  5 Changed 12 years ago by guest

Resolution: invalid
Status: closedreopened

Replying to bill:

Marking invalid; feel free to reopen with a valid testcase, as per my advice above.

Here is a test case (test_grid_layout_3.html) that shows invalid sizing of grid when we try to set it as layoutAlign="client". Grid seems to ignore arguments passed from _LayoutWidget and takes the height from parent node (it should take parent.h-topNode.h-bottom.h).

Changed 12 years ago by guest

Attachment: test_grid_layout_3.html added

Test case for invalid sizing of grid

comment:7 Changed 12 years ago by bill

Milestone: 1.01.0.1
Owner: changed from alex to sorvell
Status: reopenednew

Ah, I see the problem. resize() should accept an optional argument specfying the size. From _LayoutWidget.js:

resize: function(args){
	// summary:
	//		Explicitly set this widget's size (in pixels),
	//		and then call layout() to resize contents (and maybe adjust child widgets)
	//	
	// args: Object?
	//		{w: int, h: int, l: int, t: int}

But grid doesn't support that.

comment:8 Changed 12 years ago by Adam Peller

Milestone: 1.0.11.0.2

comment:9 in reply to:  7 Changed 12 years ago by guest

Are there any plans how it would be done? It would be nice if grid will fit whole available client area. Maybe there is a chance to add support for columns that will expand their width if there is more horizontal space available?

comment:10 Changed 12 years ago by Adam Peller

Milestone: 1.0.21.0.3

comment:11 Changed 11 years ago by dylan

Milestone: 1.0.31.1

comment:12 Changed 11 years ago by sorvell

Resolution: fixed
Status: newclosed

(In [12794]) !strict fixes #4900. Added test in bug to grid tests. Also corrected problem with autoHeight introduced by having grid hidden in an unsized container. Fixed: grid hides in an unsized container on IE.

comment:13 Changed 11 years ago by sorvell

Resolution: fixed
Status: closedreopened

comment:14 Changed 11 years ago by sorvell

Resolution: fixed
Status: reopenedclosed

[12876] Grid should now size correctly (at least in simple layouts) inside a LayoutContainer? and a BorderContainer?

Note: See TracTickets for help on using tickets.