Hi, is it possible with bancha to load a grid with associated data from a hasOne association? Let's say I have a Company with one Address and I want to show a grid with the names of the Company(s) and the fields from the Address model in one row.
How would I set that grid up in ExtJS 4 with Bancha? Ik have the associations setup in CakePHP and if I look in the console at bancha-dispatcher.php I can see all the associations when Bancha is loading the model Company. From the MySQL logs I can see that de query is done with the join on the table holding the addresses so this looks right on the CakePHP/Bancha side.
But when I load the model by Bancha.getModel('Company') it won't load the associated model Address. So what am I missing?
OK, I think I have found it. I baked the controller before I put this association in the model. The controller is just loading the data from the Companies tables without the associated Address model. I was thrown off by the bancha-dispatcher because the first time it's called it is just retrieving the metadata and that's when it is showing the right associations.
Strange that the MySQL logs show the right query though.
I will recreate the controller, see if that solves it and post back with the results.
you have touched a variaty of topics, so let me split them up:
- Loading of the MetaData as first request:
If you include the Bancha-API with /bancha-api/models/all.js the metadata is already included and this request will not be made.
- Association support:
Bancha understands associations, you don't need to re-bake the controller, Bancha takes the current model configuration and shares the associations with the frontend.
- Nested Loading:
CakePHP loads the address data for your company, but Bancha does not yet send this data directly. This is our next feature on our Roadmap and should be available before you put your app online ;-)
Currently Bancha will load the associated data (in your case the addresses) in a separate request if you need them, see this example: http://samples.banchaproject.org/ass...ns-sample.html
So you can use this in your development till the feature is ready.
Hope this clarifies things for you. Let me know if something is unclear.
Hi, I'm trying to setup Bancha MVC style but it gives me an error 404 not found on the ExtJS files. I've downloaded the Sencha Architect BlogApp application and that gives me the same error. It looks like a conflict with the app folders of Bancha and CakePHP.
ExtJS is looking for the files in app/store/Articles.js but if I open that folder in my browser it can not find it and gives me a CakePHP error that controller AppController::Store() is not found. If I go to check with setup-check.html everything is fine.
ExtJS version is 4.1.1a GPL, version of CakePHP is 2.3.5 and Bancha is the latest release.
Edit: Can confirm that this is the same with ExtJS 4.07 and CakePHP 2.2.4