Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#11430 closed defect (fixed)

BorderContainer: removing/adding pane does not remove old style information

Reported by: Simon Speich Owned by: bill
Priority: high Milestone: 1.6
Component: Dijit Version: 1.5.0rc1
Keywords: Cc: ben hockey
Blocked By: Blocking:

Description

Lets say I have a ContentPane? with region property set to 'center'. Now I want to change my layout and I set the region of that pane to 'bottom'. This does not work properly, since changing the region does not remove the old style information (e.g. 'top: 0'). The style attribute ends with containing both: 'bottom: 0; top: 0'. Workaround is to explicitly remove the top or set the top to auto.

var pane = new dijit.layout.ContentPane({ region: 'center' });
pane.set('region', 'bottom');
// pane.style will contain top: 0; bottom: 0;, but should only be bottom: 0
// workaround
dojo.style(pane, 'top', 'auto');

I think setting the region should remove the corresponding style information first (e.g. top, left, bottom, right) before setting it to prevent conflicting style information.

Change History (8)

comment:1 Changed 9 years ago by Adam Peller

you presently can't change the region property. You need to remove and re-add the pane.

comment:2 Changed 9 years ago by Simon Speich

That is actually what I'm doing. But instead of completely destroying the widget and having to recreate the pane completely, I only reset the region. This works except for that I have to reset the style attribute:

var bc = new dijit.layout.BorderContainer({});
var pane = new dijit.layout.ContentPane({ region: 'center' });
bc.addChild(pane);
...
bc.removeChild(pane);
pane.set('region', 'bottom');
 // this is necessary otherwise top would be 0 from region = center
dojo.style(pane, 'top', 'auto');center
bc.addChild(pane);

comment:3 Changed 9 years ago by bill

Summary: Changing region in ContentPane does not remove old style informationBorderContainer: removing/adding pane does not remove old style information

Also, changing the "left" pane to be the "top" pane won't work because the width setting is left over on the "left" pane.

comment:4 Changed 9 years ago by bill

(In [22474]) Initial BorderContainer tests, including test (currently with workaround) for #11430. Refs #10342, #11430.

comment:5 Changed 9 years ago by ben hockey

Cc: ben hockey added

comment:6 Changed 9 years ago by bill

Milestone: tbd1.6
Owner: set to bill
Status: newassigned

Some of this will become moot when #11030 is checked in, because that will eliminate the top/bottom/left/right setting and just set top/left/width/height. Regardless, I'll add code now to remove the attributes that BorderContainer set.

comment:7 Changed 9 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [22673]) Clear CSS settings on widgets when they are removed from BorderContainer, fixes #11430 !strict.

comment:8 Changed 9 years ago by bill

(In [23441]) Now that #11430 is fixed, remove workaround code from test, refs #11430, #11030.

Note: See TracTickets for help on using tickets.