Content rendering after javascript - Zend
I can't perform any js function fired by a dijit event unless setting the javascript file in the view itself.
I set various js files to use within my controller this way :
$layout = Zend_Layout::getMvcInstance();
$view = $layout->getView();
$view->headScript()
->appendFile('/public/js/jquery-1.5.1.min.js', 'text/javascript')
->appendFile('/public/js/jquery-ui-1.8.13.custom.min.js', 'text/javascript')
...
->appendFile('/public/js/functions.js', 'text/javascript');
which are echoed in the layout :
echo $this->headScript();
note : all of them are loaded
But when my view is rendered The events bound to the dijits elements don't fire the functions in functions.js
For example I have this dijit element :
$business = new Zend_Dojo_Form_Element_FilteringSelect('business');
$business ->setLabel("Etablissement :")
-> setStoreId('businessStore')
-> setStoreType('dojo.data.ItemFileReadStore')
-> setStoreParams(array('url' => '/public/business/getbusinesses?all=true&'))
-> setAttrib('searchAttr', 'nom')
-> setAttrib('onchange',"cB()")
-> setRequired(true)
-> setValue('business');
and the js function :
function cB() {
alert("changed");
}
But even if I wrap cB() like this it doesn't work :
$(document).ready(function() {
function cB() {
开发者_开发百科alert("changed");
}
});
Do somone has an idea ? I'm stuck with this javascript issue all over my Zend application =(
thanks !
精彩评论