[Dojo-interest] Problems creating dynamic Dialogs

Hockey, Ben Ben.Hockey at VerizonWireless.com
Thu Feb 4 12:54:20 EST 2010


I'm not sure why... but here are some possible answers:
 - _destroyAll is private so it doesn't make any promises about what it can do - you're lucky you only needed 1 extra line of code ;)
 - it could be an oversight and therefore a bug so please raise a ticket at http://bugs.dojotoolkit.org/
 - it might not be necessary for _destroyAll's purpose so please make a convincing argument via http://bugs.dojotoolkit.org/ for adding it as a feature
 - ???

I would assume that it doesn't do it in _destroyAll because it wasn't intended for you to call _destroyAll and start using widgets again... but that's not to sy that you can't try ;)

ben...

-----Original Message-----
From: dojo-interest-bounces at mail.dojotoolkit.org [mailto:dojo-interest-bounces at mail.dojotoolkit.org] On Behalf Of Tom Elliott
Sent: Thursday, February 04, 2010 12:34 PM
To: dojo-interest at mail.dojotoolkit.org
Subject: Re: [Dojo-interest] Problems creating dynamic Dialogs

Yup, that's what I'm doing and it works.

Any idea why it's not set to null in _destroyAll??

On 4 February 2010 17:06, Hockey, Ben <Ben.Hockey at verizonwireless.com> wrote:
> it seems sane - just sent dijit._underaly to null after you destroy everything then it should probably work again.
>
> ben...
>
> -----Original Message-----
> From: dojo-interest-bounces at mail.dojotoolkit.org 
> [mailto:dojo-interest-bounces at mail.dojotoolkit.org] On Behalf Of Tom 
> Elliott
> Sent: Thursday, February 04, 2010 11:50 AM
> To: dojo-interest at mail.dojotoolkit.org
> Subject: Re: [Dojo-interest] Problems creating dynamic Dialogs
>
> Never mind, figured it out.
>
> It's because the _destroyAll call kills the underlay, which I believe is the same widget for all dialogs in 1.4.
>
> So I'm assuming that it's somehow flagged as having been created when I create the first dialog and thus not created again when I kill the first dialog (and the underlay) and create the second.
>
> Anyone know if that's sane?
>
> Tom
>
> On 4 February 2010 16:27, Tom Elliott <mrtom at cantab.net> wrote:
>> Looking into this a bit more it definitely seems to be being caused 
>> by the dijit._destroyAll() call rather than anything to do with 
>> dojo.empty(dojo.body());
>>
>> On 4 February 2010 16:12, Tom Elliott <mrtom at cantab.net> wrote:
>>> Hey guys.
>>>
>>> I'm trying to do something that's potentially a little odd. 
>>> Basically I need to destroy all dijits on a page and then create some new ones.
>>> Sounds easy! I'm finding that with Dialogs about 50% of the time 
>>> they get created fine by when you call show() you get the following error:
>>>
>>> exception in animation handler for: beforeBegin
>>> :8080/js/dojo/dojo-release-1.4.1/dojo/dojo.js.uncompressed.js:10697TypeError:
>>> Cannot call method 'setAttribute' of undefined
>>> TypeError: Cannot call method 'getValue' of undefined
>>>
>>> The line number seem to suggest this is being thrown at line 10749 
>>> of dojo.js (uncompressed, v1.4.1): var value = 
>>> _t.curve.getValue(_t._getStep()); Presumably because curve is 
>>> undefined for this dojo.Animation.
>>>
>>> I assume this is because dijit._destroyAll is doing more than just 
>>> destroying all the dijits on the page, but looking at the source I 
>>> can't see what.
>>>
>>> Code is below, or see example at
>>> http://telliott.net/dojoExamples/dojo-programaticDialog.html
>>>
>>> Help appreciated!
>>>
>>> Tom
>>>
>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>>> "http://www.w3.org/TR/html4/strict.dtd">
>>> <html dir="ltr">
>>>
>>>    <head>
>>>        <link rel="stylesheet" type="text/css"
>>> href="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dijit/themes/tun
>>> d
>>> ra/tundra.css">
>>>    </head>
>>>
>>>    <body class="tundra ">
>>>
>>>    </body>
>>>
>>>    <script type="text/javascript"
>>> src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js"
>>>    djConfig="parseOnLoad: true">
>>>    </script>
>>>    <script type="text/javascript">
>>>        dojo.require("dijit.form.Button");
>>>        dojo.require("dijit.Dialog");
>>>
>>>        var counter = 0;
>>>
>>>        generateButtonAndDialog = function() {
>>>                var curCount = dojo.clone(counter);
>>>
>>>                initPage();
>>>
>>>                new dijit.form.Button({
>>>                        id: 'button'+curCount,
>>>                        label: 'Button ' + curCount,
>>>                        onClick: function() {
>>>                                dijit.byId('dialog'+curCount).show();
>>>                        }
>>>                }).placeAt(dojo.body(), 'last');
>>>
>>>                new dijit.Dialog({
>>>                        id: 'dialog'+curCount,
>>>                        title: 'This is dialog '+curCount,
>>>                        content: 'This is some content for dialog ' + 
>>> curCount + '. I was made at ' + new Date()
>>>                });
>>>
>>>                counter++;
>>>        };
>>>
>>>
>>>
>>>        initPage = function() {
>>>                if (dijit) {
>>>                        dijit._destroyAll();
>>>                        dojo.empty(dojo.body());
>>>                }
>>>
>>>                new dijit.form.Button({
>>>                        id: 'startButton',
>>>                        label: 'Click me to create a new Dialog',
>>>                        onClick: function() {
>>>                                generateButtonAndDialog();
>>>                        }
>>>                }).placeAt(dojo.body(), 'last');
>>>
>>>        };
>>>
>>>        dojo.addOnLoad(function() {
>>>                initPage();
>>>        });
>>>    </script>
>>>
>>> </html>
>>>
>>>
>>> --
>>> www.twistyfish.co.uk
>>>
>>
>>
>>
>> --
>> www.twistyfish.co.uk
>>
>
>
>
> --
> www.twistyfish.co.uk
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://docs.dojocampus.org
> Dojo-interest at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
> The information contained in this message and any attachment may be 
> proprietary, confidential, and privileged or subject to the work 
> product doctrine and thus protected from disclosure.  If the reader of 
> this message is not the intended recipient, or an employee or agent 
> responsible for delivering this message to the intended recipient, you 
> are hereby notified that any dissemination, distribution or copying of 
> this communication is strictly prohibited.
> If you have received this communication in error, please notify me 
> immediately by replying to this message and deleting it and all copies 
> and backups thereof.  Thank you.
>
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://docs.dojocampus.org
> Dojo-interest at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>



--
www.twistyfish.co.uk
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest at mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


More information about the Dojo-interest mailing list