(on Saturday, 18 October 2008, 04:39 PM +0200):
> Currently I am busy with a project that loads every page with an AJAX
> request. But that is giving me a problem with Zend_Dojo. When I am using
> Zend_Form, it will render the Form correctly, but it doesn't load the
> Dijit form widgets. It is because I can't execute the dojo.require()
> statements in the AJAX requests. Currently, I am giving some JavaScript
> with the AJAX response, but I don't know how to retrieve the
> dojo.require() and onload statements from the dojo view helper.
>
> Does anybody know how I should take this problem and get the
> dojo.require() and onload statements from the Dojo view helper, so I can
> include them in the AJAX response and execute them on the client side?
You can't, unfortunately; it's a limitation of Javascript.
The way I tackled it with the pastebin demonstration application was to
create a Dojo layer that performs all the dojo.require statements I
need; this also makes it trivial to create a custom build later to speed
the entire application up.
You can see the build file here:
http://github.com/weierophinney/pastebin/tree/master/public/js-src/paste/layer.js
The important aspect is everything up to the first dojo.addOnLoad()
statement. If you pay attention to it, basically I'm requiring
everything I may possibly need in any XHR requests I make, as well as
the requires necessary for the initial page load. When you create a
custom build with this layer file, all those will get compiled and
in-lined to a single file -- making for a concise, single file with all
functionality.
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论