-
9 Sep 2012 10:10 PM #71
How to create a find with params
How to create a find with params
Hi,
I m using this Bancha, it s look very nice, but I want to know if there is some way to create a store which return to me a specific query in database, because When I use Store only pass the model I received all record of some entity, I need to make a simple conditions: Get all eventos from client_id = x, where I can make this?
-
19 Sep 2012 1:11 AM #72
Hello guys,
sry for the late response, I just was on holiday and I finally got a little bit of color
The models associations are already supported. Currently Bancha just does not yet add associated data in a model read request (in nested arrays). There are plans to support this soon.
Associations can be quite tricky, so I might help you more if you can give me your use case.
I'm currently working on this, so far I don't have a complete solution, bit it is quite good. If you use the filter-support branch and add the following line to your cakephp controller index method you can remotely filter:
Best regardsCode:class UsersController extends AppController { public function index() { $this->User->recursive = 0; $this->Components->load('Paginator')->whitelist[] = 'conditions'; // allow Bancha to remotly filter $users = $this->paginate(); $this->set('users', $users); // provide a return value for Bancha requests return array_merge($this->request['paging']['User'], array('records'=>$users)); } ... } // and in extjs var store = Ext.create('Ext.data.Store', { model: Bancha.getModel('User'), // yes, that's all you have to do (proxy, fields. etc. is already configured) }); // now filter and load store.filter('client_id',x); store.load();
RolandRoland Schütz
Senior Software Architect
---
Bancha Project - Seamless integrate CakePHP with ExtJS and Sencha Touch
-
2 Oct 2012 1:26 AM #73
Hello guys,
i also had the same questions, so I followed this thread. I have made a store,
based on a bancha model and declared remoteFilter: true.
I tried your solution above, that is to embed the line
$this->Components->load('Paginator')->whitelist[] = 'conditions'; // allow Bancha to remotly filter
and filtered my store to a specific (property,value) pair.
Cakephp continued to retrieve all the results, without implementing any filtering.
So, with the help of firebug and cakephp documentation, I added the following lines to my controller.
My model-database table is named Person.
if (isset($this->params['pass'][0]['filter']))
{
$p=$this->params['pass'][0]['filter'][0];
$field='Person.'.$p['property'];
$val=$p['value'];
$people = $this->paginate('Person', array("$field LIKE" => "$val%"));
} else
$people = $this->paginate();
$this->set('people', $people);
return array_merge($this->request['paging']['Person'],
array('records'=>$people));
I am looking forward to the next version of Bancha.
Good work!!!
-
3 Oct 2012 2:16 PM #74
Hello kalchas,
Bancha's filter-support Branch support this, you shouldn't need the posted code. Are you sure you're on the filter-support Branch?
Check out this example of how it currently works:
http://filter-support-branch.banchap...ns-sample.html
Best regards
RolandRoland Schütz
Senior Software Architect
---
Bancha Project - Seamless integrate CakePHP with ExtJS and Sencha Touch
-
4 Oct 2012 1:02 AM #75
-
4 Oct 2012 10:19 PM #76
Nested Models
Nested Models
Dear Roland,
are you going to support nested (associated) models in a future release?
-
5 Oct 2012 2:53 AM #77
Yes, it is planed for the 1.4 release
Roland Schütz
Senior Software Architect
---
Bancha Project - Seamless integrate CakePHP with ExtJS and Sencha Touch
-
7 Oct 2012 5:34 PM #78
There've been a lot of new cool stuff in the last two weeks, check it out:
- an article how to use Bancha with Sencha Architect 2
- a Blog Reader App showcasing how to use Authentification and Sencha Architect 2
- a new documentation
- a new release, now supporting
- loading of associated records and
- remote filtering of stores
I hope you like it, and you're looking forward to a lot more new features coming up soon!Roland Schütz
Senior Software Architect
---
Bancha Project - Seamless integrate CakePHP with ExtJS and Sencha Touch
-
8 Oct 2012 2:56 AM #79
Store does not display BelongTo Association data but shows hasMany Associations data
Store does not display BelongTo Association data but shows hasMany Associations data
Hi.
I have a CakePHP Model with many associations (hasMany and belongTo both). When I see store in firebug, it shows only hasmany associations not belongTo.
Can u please help to resolve this issue with some example of belongTo Releationship.
Regards,
-
8 Oct 2012 7:20 AM #80
Hello,
thanks for pointing this out, you're right. The default behavior of ExtJS belongsTo associations doesn't work so well. I have added a bit code to Bancha, now it works smoothly. Check out the updated samples and the code on github or the package download.
Best regards,
Roland


Reply With Quote