Hello. Yes, component working with 2.1.
What is wrong?
Printable View
Hello. Yes, component working with 2.1.
What is wrong?
Thanks for your quick reply. I guess I must be doing something wrong
I get two javascript errors :Below you will find an extract of infoController.php :
- Uncaught TypeError: Cannot read property 'getInfos' of undefined : Ext.app.AUDirectory_Info.getInfos is called in my proxy, AU/DirectoryBundle being my bundle namespace and infoController the controller where you will find getInfosAction
- Afterwards : You're trying to decode an invalid JSON String : my browser actually receives an HTML file
an extract of config.yml :Code:public function getInfosAction()
{
$query = $this->getDoctrine()
->getEntityManager()
->getRepository('AUDirectoryBundle:Info')
->findInfos();
return $this->get('ext_direct')
->createResponse(new AbstractQuery(), $query);
}
an extract of info.jsCode:ext_direct:
router:
rules:
getInfos:
defaults: { _controller: AUDirectoryBundle:Info:getInfos, params: true }
reader: { root: root }
an extract of app.js (the function in init does not get the chance to be executed) :Code:proxy: {
type: 'direct',
api: {
read: Ext.app.AUDirectory_Info.getInfos,
},
reader: {
type: 'json',
root: 'root'
}
}
Any help is very appreciatedCode:Ext.application({
...
init: function() {
console.log('init app');
Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);
},
...
});
Please, show me your /api.js
Try this:
Code:proxy: {
type: 'direct',
api: {
read: Actions.AUDirectory_Info.getInfos,
},
reader: {
type: 'json',
root: 'root'
}
}
Below api.js without performing the modification you suggested :
I get exactly the same error messages and api.js file when I replace Ext.app with Actions as you suggested. And when I apply the change in the definition of the provider in app.js that does not make any difference.Code:Ext.ns("Actions"); Actions.REMOTING_API = {"type":"remoting","namespace":"Actions","url":"\/automation\/web\/app_dev.php\/route","actions":{"AUDirectory_Info":[{"name":"getInfos","len":1}]}};
First. If you have namespace "Actions" in api.js, you need use this namespace and for calling remote procedures.
This is working for me, example from real project.
Template:
App.js:Code:<script type="text/javascript" src="http://localhost/api.js"></script>
Try use without change namespace in any places.Code:Ext.require([
...
'Ext.direct.*',
...
], function() { Ext.direct.Manager.addProvider(Actions.REMOTING_API); });
Thanks a lot for your help GH1UA that actually works ! I guess the provider must be defined ASAP
Hola como estas? el link no funciona paso algo ? muchas graxias
Sorry, the project has been updated. Follow the new link: https://github.com/oaugustus/direct-bundle