服务器端可排序表

时间:2014-12-17 08:32:48

标签: php cakephp jquery-ui-sortable

我想使用CakePHP做可排序表。我需要做服务器端排序,我试试这种方式。

<table class="">
    <thead>
        <tr>
            <th><?php echo $this->Paginator->sort('Eesnimi', 'Eesnimi'); ?></th>
            <th><?php echo $this->Paginator->sort('Perenimi', 'Perenimi'); ?></th>
            <th><?php echo $this->Paginator->sort('Maakond', 'Päritolu'); ?></th>
            <th><?php echo $this->Paginator->sort('Telefon', 'Telefon'); ?></th>
            <th>Tegevused</th>
        </tr>
    </thead>

在控制器中我有:

public $components = array('Session', 'Paginator');

        public $paginate = array(
        'limit' => 25,
        'order' => array(
            'Post.title' => 'asc'
        )
    );

但它没有用,我收到很多错误:

Warning (2)
: array_merge() [
function.array-merge
]: Argument #1 is not an array [CORE\Cake\View\Helper\PaginatorHelper.php, line 430]

也许有人可以帮助我并给我一些线索,我做错了什么或怎么做。 谢谢!

已更新

现在我在Controller中得到了这个,没有错误,但这不再排序我的表,但现在看起来很好,正确。我想:如果我点击一个列标题然后它对这个colmun进行排序。我想,即将到来。

    public function index() {
        $this->set('kontaktid', $this->Kontaktid->find('all'));

        $this->paginate = array(
        'Kontaktid' => array(
            'conditions' => array('Kontaktid.id'),
            'limit' => 100,
            'recursive' => 0
        )
        );
        $kontaktid = $this->paginate('Kontaktid');
        $this->set('Kontaktid', $kontaktid);
    }

我的表格显示:

enter image description here

0 个答案:

没有答案