Uncle Aaroh
Uncle Aaroh

Reputation: 831

AGILETOOLKIT :: How do you add drop-downs on CRUD popup?

I have 3 tables namely users, items and purchase.

Purchase hasMany('Users') and hasMany('Item'). Now when you

class Model_Purchase extends Model_Table {
public $table = 'purchase';
function init(){
    parent::init();

    $this->hasMany('Users');
    $this->hasMany('Item');


    $users = $this->join('users.id', 'users_id', 'left' );
    $users->addField('user_name');

    $users = $this->join('item.id', 'item_id', 'left' );
    $users->addField('item_name');

}
}

Now, when i click on the 'Add' a form opens with text fields. What i want is a dropdown list of all users and all items over there.

Do i need to implement it by querying each table seperately and selecting users from one table then selecting items from other table ?

And how can i make changes in that 'CRUD' popup?

Here is the reference URL, to check my implementation : http://qambarraza.com/projects/purchaseitem/?page=purchase

Thanks,

Qambar Raza

Upvotes: 1

Views: 219

Answers (1)

romaninsh
romaninsh

Reputation: 10664

In your case purchase hasOne item and hasOne user. This should give you the popups.

Upvotes: 3

Related Questions