php - Pagination without default order -
i have code below:
$firm_ids = array(81, 96, 18, 5, 105); $this->paginate = array( 'conditions' => array('firm.id' => $firm_ids), 'limit' => 10, ); $this->set('firms', $this->paginate('firm')); in results have ordering in:
5, 18, 81, 95, 105 how disable default order if want order initial array ordering?
i found workaround on forum, see if works:
$this->paginate = array( 'conditions' => array('firm.id' => $firm_ids), 'limit' => 10, 'order' => array( 'field(firm.id,' . implode(',',$firm_ids) . ')' ) );
Comments
Post a Comment