atk4 / mastercrud

Manipulates ATK CRUD through the force of references
https://atk4.org
MIT License
9 stars 7 forks source link

How do you use MasterCRUD to specify which columns you would like to see on the grids? #14

Closed rapgithub closed 6 years ago

rapgithub commented 6 years ago

I tried to use this $crud->setModel($eu_countries, ['name']); but it does not work with MasterCRUD...

how will you set this using MasterCRUD?

in my case I have

$mc = $app->add([ '\atk4\mastercrud\MasterCRUD', 'ipp'=>5, 'quickSearch'=>['name'], ]); $mc->setModel(new Deal($app->db), [ 'DealInfo'=>['DealInfo'=>['CRUD', 'canDelete'=>false, 'ipp'=>5]], ] );

and I want to hide for instance from the Grid these columns:

origen, destination, price, etc....

any ideas? thanks

rapgithub commented 6 years ago

I tried to use this fieldsRead but it does not work for the second table...

$app->cdn['atk'] = '../public'; $mc = $app->add([ '\atk4\mastercrud\MasterCRUD', 'ipp'=>5, 'quickSearch'=>['name'], 'fieldsRead'=>['name'] ]); $mc->setModel(new Deal($app->db), [ 'DealDates'=>['DealDates'=>['CRUD', 'canDelete'=>false, 'ipp'=>5, 'fieldsRead'=>['origin_id','price'] ]], ] );

I want first table to have only displayed in the grid table 'fieldsRead'=>['name'] and in the relational table 'fieldsRead'=>['origin_id','price'] but it only works with the first table and the second table shows the same columns as the first table too 'fieldsRead'=>['name']...

is there a way to show difference columns for the source table and different for the relational table?

thanks

romaninsh commented 6 years ago

wrap it one more time:

'DealDates'=>[['DealDates'=>['CRUD', 'canDelete'=>false, 'ipp'=>5, 'fieldsRead'=>['origin_id','price'] ]]],

Example is updated to reflect.