• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Model Class - protected field for Order By

#1
Please could you add a protected field for "Order By" in the Model Class.

Currently the data is ordered by the $primaryKey.

E.g. where this would be most helpful:  Tables that are used as option data for select fields, where users can add items.
Let say I have a classification and the columns in the table is ID (PK) and Description,  where using findAll(), the function fetches the data and it is sorted by ID and displayed in the Select Lookup in that order.  If Order by was set as a protected var, we can immediately set the default sort order to description.

Currently you now have to create a custom function the add the order by clause prior to using findAll() e.g. $this->orderBy('description')->findAll().
Dirk B.
No SEO spam - see forum guidelines
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.