hello!

I have a problem with Zend_Dojo.

Trying example from
http://framework.zend.com/manual/en/zend.dojo.view.html#zend.dojo.view.dijit.layout.borderexample
but browser ends with an error:
[Exception... "'Error: Tried to register widget with id==masterLayout but
that id is already registered' when calling method:
[nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c
(NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]

Element with id masterLayout is unique.

Layout helpers generate imho corectly dojo code, like this:
dojo.addOnLoad(function() {
    dojo.forEach(zendDijits, function(info) {
        var n = dojo.byId(info.id);
        if (null != n) {
            dojo.attr(n, dojo.mixin({ id: info.id }, info.params));
        }
    });
    dojo.parser.parse();
});
var zendDijits =
[{"id":"topPane","params":{"region":"top","dojoType":"dijit.layout.ContentPane"}},{"id":"mainPane","params":{"region":"center","dojoType":"dijit.layout.ContentPane"}},{"id":"masterLayout","params":{"design":"headline","dojoType":"dijit.layout.BorderContainer"}}
 
etc for all elements ...


Value of Zend_Dojo_View_Helper_Dojo::$_useProgrammatic is default from ZF
distribution.
Problem disappears whe i call
Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); in init method of
controller. I'd like to use but
Zend_Dojo_View_Helper_Dojo::setUseProgrammatic(1); - page isn't valid in
declaration mode etc

I do something wrong?
Code in view script is the same as an example.

This is my inicialize dojo:
class DefaultController extends Zend_Controller_Action
{
        public function init()
        {
                Zend_Dojo::enableView($this->view);
                $this->view->dojo()
                        ->enable()
                        ->setLocalPath('/shared/scripts/dojo/dojo.js')
                        ->setDjConfig(
                                array(
                                        'parseOnLoad' => 'true',
                                        'locale' => 'cs',
                                        'usePlainJson' => 'true'
                                )
                        );
        //[...]
        }
}

In layout script have it:
<head>
[...]
if($this->dojo()->isEnabled()){
        $this->dojo()->addStyleSheetModule('dijit.themes.tundra');
        echo $this->dojo();
}
</head>

Version of Zend Framework: 1.7.3
Version of Dojo: 1.2.3 (But it's the same with 1.2.X)

Thank you for any advice.
-- 
View this message in context: 
http://www.nabble.com/Zend_Dojo---javascript-error-in-generated-layout-elements-tp21665233p21665233.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to