Hi All,
Is there a way to change the view order of the fields?
For example I have a table test and i have some columns in it: id, name, title, address
If i use the crud it display the fields the same order. But what if I would like to change it, so in my Add record page I wish to see this: id field, title field, name field and address field. Is it possible or I have to change the structure of my table?
Thx a lot
Change field order
- Single Page
Posted 25 August 2013 - 14:16 PM
Posted 25 August 2013 - 15:12 PM
I solved it. :)
Did it via the mysql database and I used this:
ALTER TABLE my_table MODIFY COLUMN field1 int(11) AFTER field2;
Posted 25 August 2013 - 15:39 PM
well the other way around was you could have set the name order in columns table. The order in which it they are set will be displayed.
Posted 28 August 2013 - 04:22 AM
U could change the displaying order like "Amit shah said". Example
If ur table column : Student, Age, Gender and if u want to display like Gender, Student Name, Age means
you can change the order in grid list by
List page : $crud->columns('Gender',Student Name','Age');
If u want to do the same thing in add page means
Add Page : $crud->add_fields('Gender',Student Name','Age');
Edit Page : $crud->edit_fields('Gender',Student Name','Age');
Posted 01 September 2013 - 17:25 PM
you can use $crud->column('field1','field2'); it shows list you also set field order in edit by $crud->fields('field1','field2');
Posted 12 May 2015 - 08:57 AM
Hi all,
why this doesn't work in the record's fields order (click on magnifying glass in table list records)?
Posted 13 May 2015 - 10:39 AM
$this->read_fields = $args;
Posted 13 May 2015 - 12:23 PM
Probably, a better solution is add a new function as the following:
public function view_fields() { $args = func_get_args(); if(isset($args[0]) && is_array($args[0])) { $args = $args[0]; } $this->read_fields = $args; return $this; }
Bye,
infinito1971