-- avennells <[email protected]> wrote
(on Friday, 23 September 2011, 04:20 AM -0700):
> did you find a solution for this? I am having the same problem. Below is a
> copy of a post on forums.zend.com which isn't responding.
>
> I have an index action controller that is istantiating a dojo enabled form.
> the inital form renders fine and the dojo works fine to start with. However,
> I have then created an ajax function to call the index on a select box
> change. This will then re-render the index.phtml with a new form, but the
> elements are not dojo enabled.
Question: are the dijits part of an HTML payload from an XHR request? or
is the page actually being fully reloaded?
If the latter, it should work.
If the former, after you inject the returned HTML into the DOM, you'll
need to have dojo.parser parse it. Since I assume you know the ID of the
DOM element into which the HTML was injected (or the ID of an element in
the returned HTML), you can do this pretty easily:
dojo.parser.parse("id-of-containing-element");
The above will likely need to be in whatever XHR return handler you
create, and would follow injection of the HTML into the DOM structure.
> I have spent ages trying different approaches but can' find out why
> the new form will not show dojo. All the elementsare created in the
> same form. If I render the new form with the inital form it works
> fine. In the code below I call disable layout. I have also tried
> without calling disable layout to see if the input within the new
> created layout on the page were dojo enabled but they are not either.
> I have been working on this for weeks and getting nowhere. here's the
> code, of course it is not the full code but just to show my method.
> let me know if you need more
>
> //IN indexController
>
> public function indexAction()
> {
> // action body
> Zend_Dojo::enableView($this->view);
>
> $form = $this->getForm();
> $this->view->form = $form;
>
> $asset = $this->getRequest()->getParam('asset');
> $variables = array('asset' => $asset);
> $this->view->assign($variables);
>
> if( $asset )
> {
> Zend_Layout::getMvcInstance()->disableLayout();
> $this->render('index');
> }
> else
> {
> $this->render('index');
> }
> }
>
>
> //in Index.phtml
>
> <?php
> if( !$this->asset )
> {
> ?>
> //these elements have the dojo widgets
> <li class="left_col">
> <?php echo $this->form->firstName; ?>
> </li>
> <li class="right_col">
> <?php echo $this->form->lastName; ?>
> </li>
> </ul>
>
> <ul class="elements">
> <li class="left_col">
> <?php echo $this->form->companyName; ?>
> </li>
> <li class="right_col">
> <?php echo $this->form->email; ?>
> </li>
> </ul>
> <?php
> }
> else
> {
> switch( $this->asset )
> {
>
>
> case '0':
> echo'';
> break;
>
> case 'vehicle':
> //these elements do not have the dojo widgets
> echo "
> <ul class='elements'>
> <li class='left_col'>
> ".$this->form->make."
> </li>
> <li class='right_col'>
> ".$this->form->model."
> </li>
>
> </ul>
> <ul class='elements'>
> <li class='left_col'>
> ".$this->form->supplier."
> </li>
> <li class='right_col'>
> ".$this->form->cost."
> </li>
> </ul>";
> }
> }
> ?>
> </div>
>
> I will be extremely grateful to anyone for any help in this.
>
> thanks in advance
>
> andy
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Zend-Dojo-Ajax-dynamically-adding-Dojo-Elements-but-they-aren-t-dojo-fied-tp1288756p3836505.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: [email protected]
> Info: http://framework.zend.com/archives
> Unsubscribe: [email protected]
>
>
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]