
Zend Framework, lazy-loaded Dojo Tabs and Javascript
by Cameron
Here's a quick tip that might save a few of you some time out there. When lazy loading tabs in Dojo + Zend Framework, because the content is retrieved via AJAX, you aren't able to just embed Javascript in the page you're fetching and have it work, nor can you apply any onLoad functions at application start, because the pages have not been instantiated. The way around this is to use the onLoad function of the contentPane view helper:<?php
( $this->contentPane(
'tab-name',
'',
array('title' => 'Demonstration Tab',
'class' => 'tab',
'href' => $this->url(
array( 'controller' => 'controllername',
'action' => 'list',
'format' => 'ajax'
),
'default',
false ),
'parseOnLoad' => true,
'onLoad' => 'loadTabCode();',
));
?>Simply include any code you wish to execute in your loadTabCode() function (or indeed just define it right there in the view helper), and it'll work just fine! This wasn't documented anywhere obvious for me, and it was a mere fluke I stumbed upon how to do it, so I hope this saves someone else a lot of head scratching too.
January12

I thing nice blog eurosportbet
I was having the same problem, thanks for sharing your finding. I was trying to connect to an event of the actual tabContainer, with no luck, but your solution did the trick. Thanks
Julian Castaneda - Smooka.com
thanks for the code ekspekt
how to do in javascript
Post new comment