To order the dropdown list maked with $crud->set_relation
- Single Page
Posted 01 March 2012 - 10:54 AM
Is it possible to order the dropdown list maked with $crud->set_relation? I explain myself...
Imagine I have a table 'music_bands' with a column 'type_id' wich refers to a table 'type_band'. So, I'd implement it like...
[color=#ff0000]$crud->set_relation('type_id', 'type_band', 'band_description')[/color]
That will make a dropdown list in the add/edit form ordered by 'band_description'. Whay I'd like [b]it's to choose this order[/b], for example, order it by the 'type_id'.
Ok, there's this an option: [color=#ff0000]$crud->set_relation('type_id', 'type_band', '{type_id} - {band_description}')[/color], but I don't like it, because I just want to see in the list the drescription.
Any suggestion?
Thanks a million.
Posted 03 March 2012 - 16:51 PM
For example:
$crud->set_relation('type_id', 'type_band', '{type_id} - {band_description}',array('status' => 1),'type_id');
or if you don't want the 4th parameter with a where clause you can simply do:
$crud->set_relation('type_id', 'type_band', '{type_id} - {band_description}',null,'type_id');
This functionality is already done so you can download the latest trunk version from github ( https://github.com/scoumbourdis/grocery-crud/zipball/master ).
Posted 05 March 2012 - 08:43 AM
Posted 12 September 2012 - 16:48 PM
I have one doubt. How do we specify multiple conditions in where clause.
e.g. I want drop down list with status as 1 or status as 3
how to get this one?
can you please help.
Thank you.
Regards,
Ashish Nirkhe