How to create cascaded/dependent dropdown from db with ATK4.2.25

48 views
Skip to first unread message

Marty

unread,
Mar 25, 2014, 12:22:30 PM3/25/14
to agile-too...@googlegroups.com
Hi Group,
So far I couldn't find a  recent/working example for this (did find this http://demo39.agiletoolkit.org/demo.html?t=20):

Select Manager (dropdown) 
Select Fund (dropdown) 
Show CRUD with performance

My models:

Model Manager
hasMany('Fund')

Model Fund
hasOne('Manager')
hasMany('Performance')

Model Performance
hasOne('Fund')

Page performance
$f = $this->add('Form');
$manager_list = $f->addField('dropdown','Manager')
->setEmptyText('Select Manager');
$manager_list->setModel('Manager');

..I got stuck here..

Any pointers, examples on how to solve this are appreciated

Marty

Miss Khushbu

unread,
Apr 2, 2014, 4:49:40 AM4/2/14
to agile-too...@googlegroups.com
Using this

$f = $this->add('Form');
$manager_list = $f->addField('dropdown','Manager')
->setEmptyText('Select Manager');
$manager_list->setModel('Manager');

$fund_list = $f->addField('dropdown','Fund')
->setEmptyText('Select Fund');
$fund=$this->add('Model_Fund');

if($_GET['manager_id']) 
                        $fund->addCondition('manager_id',$_GET['manager_id']);
      
              $fund_list->setModel($fund);

              $fund_list->js('change',$form->js()->atk4_form('reloadField','Fund',array($this->api->url(),'manager_id'=>$manager_list->js()->val())));

Marty

unread,
Apr 2, 2014, 10:22:38 AM4/2/14
to agile-too...@googlegroups.com
Hi Miss Khushbu, 

Thanks for taking the time to point me in the right direction, had to make slight change to get it working (js). So hope this can help some one else in the future.

        $manager_list->js('change',$f->js()
->atk4_form('reloadField','fund',array($this->api
->url(),'manager_id'=>$manager_list->js()->val())));

Romans Malinovskis

unread,
Jul 20, 2014, 3:37:07 PM7/20/14
to agile-too...@googlegroups.com
Let me add that here is the documentation for the addConditionShow feature:

Reply all
Reply to author
Forward
0 new messages