Login   Register  
PHP Classes
elePHPant
Icontem

Reorder records

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Auto form  >  All threads  >  Reorder records  >  (Un) Subscribe thread alerts  
Subject:Reorder records
Summary:Specific order to display fields
Messages:5
Author:Rolando
Date:2013-02-20 22:13:56
Update:2013-02-23 22:54:49
 

  1. Reorder records   Reply   Report abuse  
Picture of Rolando
Rolando
2013-02-20 22:13:56
Hi, congratulations for the great class!

Sorry my english weak! :(

How could I pass through an array of a specific order to display the fields of the table (eg, $order = array ("name", "id", "other"))? I think should rearrange the array generated by the get_table_info(), but this is a multidimensional array and I dont know how to reset this order based on the value of $arr[$count]["name"] .....


     [0] => Array
         (
             [name] => id
             [type] => int
             [size] => 11
             [default] =>
             [validate] => 1
             [key] => PRI
             [Extra] => auto_increment
         )

Thanks

  2. Re: Reorder records   Reply   Report abuse  
Picture of Arturs Sosins
Arturs Sosins
2013-02-21 10:58:46 - In reply to message 1 from Rolando
Hello Rolando, ;)

Yes you are right about changing the order of get_table_info()

I've updated the package to include that functionality.

Basically what I did is added new private $order = array();

Then provided a method of setting this order array:
//set order array of inputs
public function set_order($order){
$this->order = $order;
}

and created two methods searchForInput and reorder to reorder this array before returning from get_table_info function.

You can download new version from PHPClasses and try it out ;)

  3. Re: Reorder records   Reply   Report abuse  
Picture of Arturs Sosins
Arturs Sosins
2013-02-21 11:00:04 - In reply to message 1 from Rolando
Oh yes, and you can use it as
$form->set_order(array("tbl_filed_name1", "tbl_field_name2", "etc"));

  4. Re: Reorder records   Reply   Report abuse  
Picture of Rolando
Rolando
2013-02-23 22:50:21 - In reply to message 3 from Arturs Sosins
Wow, thank you! Your solution is exactly what I needed.

  5. Re: Reorder records   Reply   Report abuse  
Picture of Diego Medeiros
Diego Medeiros
2013-02-23 22:54:49 - In reply to message 4 from Rolando
I was trying to solve the same problem ... Thank you!