我收到今天的数据:
public function index() {
$this->Apertura->recursive = 0;
$now = new DateTime();
$options = array('conditions' => array('Apertura.created >= ' => $now->format('Y-m-d 00:00:00')));
$this->set('aperturas',
$this->Apertura->find('all', $options),
$this->Paginator->paginate('Apertura', array('Apertura.created >= ' => $now->format('Y-m-d 00:00:00'))));
}
但是当我把一个标题栏引用时,我无法对表格进行排序:
<th><?php echo $this->Paginator->sort('id',"ID"); ?></th>
<th><?php echo $this->Paginator->sort('Vendedore.nombre',"Vendedor"); ?></th>
<th><?php echo $this->Paginator->sort('vehiculo_id',"Vehículo"); ?></th>
<th><?php echo $this->Paginator->sort('observaciones',"Observaciones"); ?></th>
<th><?php echo $this->Paginator->sort('created',"Hora y fecha"); ?></th>
如果我删除条件和自定义 Paginate ,我可以对表格进行排序。发生了什么事?
答案 0 :(得分:0)
是的,解决方案是:
public function index() {
$this->Apertura->recursive = 0;
$now = new DateTime();
$this->Paginator->settings = array(
'conditions' => array('Apertura.created >= ' => $now->format('Y-m-d 00:00:00')),
'limit' => 10
);
$data = $this->Paginator->paginate('Apertura');
$this->set('aperturas',$data);
}