Opened 13 years ago

Closed 9 years ago

#8729 closed enhancement (wontfix)

[patch] dojox.widget.Dialog enhancement - trimWhiteSpace

Reported by: Josh Trutwin Owned by: dante
Priority: high Milestone: future
Component: DojoX Widgets Version: 1.3.0b1
Keywords: dojox.widget.Dialog sizing viewport Cc:
Blocked By: Blocking:


Attaching patch to dojox.widget.Dialog to support a trimWhiteSpace param (for lack of a better name) which when activated will shrink Dialog's height to accomodate for situations where there is much more space than needed for your content. This is generally useful when using sizeToViewport and the loaded content is smaller than the size needed. I suppose it might be useful if you also set an absolute width on the dialog but my implementation only allows the option if sizeToViewport is also set.

The implementation is not all that exciting or performance friendly, but was the only way I could find to reliably get the size of the content. Before the sizeTo animation I use dojo.create to create a node off-screen containing the Dialog's content and the width that the dialog will be sized to - from there I can get the actual height of the content and test if it's less than the size that the dialog is about to be sized to - if so use the actual height.

Attachments (2)

Dialog_trimWhiteSpace.patch (6.0 KB) - added by Josh Trutwin 13 years ago.
Patch against trunk to add timWhiteSpace param to dojox.widget.Dialog
Dialog_trimWhiteSpace_iefixed.patch (7.8 KB) - added by Josh Trutwin 13 years ago.
Updated patch to fix issues with ie6/ie7

Download all attachments as: .zip

Change History (6)

Changed 13 years ago by Josh Trutwin

Attachment: Dialog_trimWhiteSpace.patch added

Patch against trunk to add timWhiteSpace param to dojox.widget.Dialog

comment:1 Changed 13 years ago by Josh Trutwin

Looks like something I did breaks the tests in ie badly.

exception in animation handler for: onAnimate: Error: invalid argument


comment:2 Changed 13 years ago by Josh Trutwin

Ok - attaching a new patch that fixes the problem with ie6/ie7. What happened for some reason that I can't quite wrap my brain around is that my modification to _position would re-trigger the layout() method, presumably from the dojo.connect to layout() on the onresize event in dijit.Dialog(), calling layout() while the sizing animation was taking place. This would call _position again, which would call layout() again, etc. etc.

I added a check in layout to not do it's business if the this._sizing var was set, which cleared the looping behavior (e.g. don't call layout() while the sizing animation was playing). This required deleting the this._sizing var also. The problem with this was that the initial layout would be fine, but after resizing the window it seemed like we needed one call to re-layout in ie. I added a this._reLayout mechanism to make sure that after resizing dijit._position() gets called to properly place the dialog.

What a pain, the original patch "just works" with firefox, all these changes are to accommodate ie.

Also of note:

  1. ie still shows an error on load: "Error undefined running custom onLoad code: Invalid argument." - not so in firefox.
  1. the following dojo.create works in firefox:
var myDiv = dojo.create("div", { 
	innerHTML: this.containerNode.innerHTML,
	style: "left: -9999px; width: " + props['width'] + "px;" 
}, dojo.body());

but to get the proper height in ie, it seems the styles weren't correctly being applied so I had to do this instead:

var myDiv = dojo.create("div", { 
	innerHTML: this.containerNode.innerHTML
}, dojo.body());,{
	left: '-9999px',
	width: props['width'] + 'px'

Maybe a bug with dojo.create()?

  1. in ie7 (but not ie6) a very rapid drag of the window border to resize the window will result in incorrect padding. Slow drags always work. :/ This is related to my changes as it works in the 1.3b2 test fine.

I'm curious to know if there's a better approach to solving this problem cause after making these changes it seems like an ugly patch....



Changed 13 years ago by Josh Trutwin

Updated patch to fix issues with ie6/ie7

comment:3 Changed 13 years ago by dante

Milestone: tbdfuture

the above 2) is because you are passing "style" as a string:

style: "width:200px; height:200px"

it should be:

style: { width:"200px", height:"200px" }

the information in this ticket is well out of the scope of this enhancement I think. will need to readdress.

comment:4 Changed 9 years ago by Colin Snover

Resolution: wontfix
Status: newclosed
Summary: dojox.widget.Dialog enhancement - trimWhiteSpace[patch] dojox.widget.Dialog enhancement - trimWhiteSpace

This widget is abandoned.

Note: See TracTickets for help on using tickets.