php - CakePHP sort by one column then another column -
Is it sorted from page to page with any column in kPPHP? I have this code
$ this-> Paginate = array ('project' = & gt; array ('border' = & gt; $ limit, 'fields' => array ('DISTINCT (project.ID) AS ID, project.product_type_id,' Project.contact_id ',' Project.company_id ',' Project.due_date ',' Project.subject ',' Project.description ',' Project.created ',' Project.creator ',' Project.project_status_id ',' Project.modified ', 'Project.complete_date',), 'joins' => Array (array (' table '= & gt;' project_reminder_users', 'alias' = & gt; ProjectReminderUser', 'type' = & gt; left ',' Conditions' = & gt; array ('Project.id = ProjectReminderUser.project_id',),),), 'conditions' => array (' user.group_id '=> $ this- & gt; ; Session-> Read ('Auth.User.group_id'), 'Project.creator' = & gt; $ this-> Session-> Read ('Auth.User.id'),), 'Order' = & gt; 'Project.project_status_id',)); $ This- & gt; Set ('grouptask', $ this- & gt; paginated ('project'));
And as a result, something that will happen with Project.project_status_id
will be the order of the task name. Due date Position | Work 1 - | Open | Task 2 | 2/15/2014 | Open | Task 3 | 2/28/2014 | Open | Task 4 | 2/20/2014 | Open | Task 5 | - | Open | Task 6 | - | Open | Task 7 - | Off | Work 8 - | Off |
Is it anyway that it can be sorted according to the sorted date based on the condition, it will look like
the name of the job. Due date Position | Work 1 - | Open | Task 5 | - | Open | Task 6 | - | Open | Task 2 | 2/15/2014 | Open | Task 4 | 2/20/2014 | Open | Task 3 | 2/28/2014 | Open | Task 7 - | Off | Work 8 - | Off | Itemprop = "text">
Try it out:
'Order' = & gt; Array ('first_field' = & gt; 'DESC', 'second_field' = & gt; 'ASC')
Comments
Post a Comment