2009年2月25日星期三

Re: [fw-mvc] Dijit dialog and zend form

If you can put <script> content before the dojo.js <script> tag (or the
view allows you to set artibtrary djConfig parameters):

var djConfig = { require:["dijit.Dialog", "dijit.form.Button",
"dijit.form.CheckBox" ] } and so on will automatically issue
dojo.require calls for each name. Handy sometimes. Pollutes the tag if
you are putting djConfig as an attribute of the dojo.js <script>:

<script djConfig="require:['dijit.Dialog', 'dijit.form.Button'],
parseOnLoad:true" src="dojo.js"></script>

I find it to be ugly myself. The best thing would be to create a custom
namespace, and track all your dependencies in one .js file (per view,
app, whichever) and issue only the one require() for it.

dojo.require("my.dependencies");

and my/dependencies.js =
dojo.provide("my.dependencies");
dojo.require("dijit.Dialog"); // etc

Then building a layer is transparent.

Regards,
Peter

mail@roccogalluzzo.com wrote:
> have resolved using declarative and adding manually the dijits elements
> on page with dojo.require.
>> <?
>> $this->dojo()->javascriptCaptureStart();
>> ?>
>>
>> dojo.require("dijit.form.Button");
>> dojo.require("dijit.Dialog");
>> dojo.require("dijit.form.TextBox");
>> dojo.require("dijit.form.NumberTextBox");
>> dojo.require("dijit.form.CheckBox");
>> dojo.require("dijit.form.CheckBox");
>> <?
>> $this->dojo()->javascriptCaptureEnd();
>> ?>
>
> is possible to add automatically the require dijits (or add all with one
> line of code)?
>
> Matthew Weier O'Phinney ha scritto:
>> -- mail@roccogalluzzo.com <mail@roccogalluzzo.com> wrote
>> (on Wednesday, 25 February 2009, 03:08 PM +0100):
>>> have tried to set a custom dojo form on a dijit.Dialog (have use
>>> Ajaxcontest to print form without layout), now on dialog window
>>> don't work dojo tha use for form field.How do to enable dojo on
>>> dialog box?
>>
>> You're not really giving enough detail here.
>>
>> One thing to be aware of, however, is that dijit.Dialogs are appended to
>> the <body> node -- which means that the <body> tag needs to have a class
>> attribute specifying the dijit them you're using in order for the dialog
>> -- and its contents -- to be styled correctly.
>>
>> Second, when you're returning a form with dijits via XHR, then you need
>> to use declarative markup when generating the form -- programmatic
>> markup will not work. You can enable this easily in your view script:
>>
>> Zend_Dojo_View_Helper_Dojo::setUseDeclarative(true);
>>
>
>


--
Peter E Higgins
Dojo Project Lead : SitePen Support Lead
http://dojotoolkit.org : http://sitepen.com

没有评论: