"Ext.onReady is not a function"
Bonjour,
Après avoir suivi un tutoriel pour un plugin Symfony (je ne pense pas que ce soit lié à ce framework mais vraiment un problème JS), je me retrouve avec l'erreur suivante :
Citation:
Ext.onReady is not a function
[Break on this error] Ext.onReady(myApp.app.init, myApp.app);
code de mon template :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| <script type="text/javascript">
Ext.namespace('myApp');
myApp.content = null;
myApp.app = function() {
return {
init : function() {
var items = Ext.ComponentMgr.create(myApp.content);
this.viewport = new Ext.Viewport( {
layout : 'fit',
border : false,
items : items
});
// This command enable component to execute a function send by symfony
// Use by error to invalidate component
this.viewport.cascade(atolExt3WidgetPlugin.cascadeFunctionToCall);
}
}
}();
Ext.onReady(myApp.app.init, myApp.app);
</script>
<?php
$formPanel = new PluginExt3FormPanel('/', $form);
$formPanel->setAttribute('title', "Hello World !");
// It's really recommended to create a helper which write these lines, and adapt it to your application
$ret = '<script type="text/javascript">';
$ret .= 'myApp.content = '.$formPanel->__toString();
$ret .= '</script>';
echo $ret;
?> |
Détails :
- le plugin utilise extJS 3.0 ;
- j'inclue comme librairie : ext-base.js ;
- lorsque j'inclue aussi ext-all.js, je me retrouve avec l'erreur suivante :
Citation:
types[config.xtype || defaultType] is not a constructor
[Break on this error] return config.render ? con...config.xtype || defaultType](config); ext-all-debug.js (ligne 13521)
ligne incriminée :
Code:
1 2 3 4 5 6 7 8 9 10 11
| /**
* Creates a new Component from the specified config object using the
* config object's {@link Ext.component#xtype xtype} to determine the class to instantiate.
* @param {Object} config A configuration object for the Component you wish to create.
* @param {Constructor} defaultType The constructor to provide the default Component type if
* the config object does not contain a <tt>xtype</tt>. (Optional if the config contains a <tt>xtype</tt>).
* @return {Ext.Component} The newly instantiated Component.
*/
create : function(config, defaultType){
return config.render ? config : new types[config.xtype || defaultType](config);
}, |
Merci de toute aide !! Pour le moment, Google n'a pas été mon ami ...