Zend框架中的AJAX分页

Zend框架中的AJAX分页,ajax,zend-framework,pagination,helper,Ajax,Zend Framework,Pagination,Helper,如何使用Zend_框架显示AJAX分页数据 是否有使用paginationControl()、ajaxLink()和ajaxContext()助手的好例子 你愿意分享你的实现吗 您可以使用带有简单分页的表格,包括: 以下是一个例子: 控制器: <?php class ExampleController extends Zend_Controller_Action { public function init() { /* Initialize actio

如何使用Zend_框架显示AJAX分页数据

  • 是否有使用
    paginationControl()
    ajaxLink()
    ajaxContext()
    助手的好例子
  • 你愿意分享你的实现吗

您可以使用带有简单分页的表格,包括:

以下是一个例子: 控制器:

<?php
class ExampleController extends Zend_Controller_Action
{
    public function init()
    {
        /* Initialize action controller here */
    }
    public function indexAction()
    {
        // action body
        $this->view->headTitle()->append('Example');
        //populate database tables
        $example = new Application_Model_ExampleMapper();
        $this->view->entries = $example->fetchAll();
    }
}


AjaxLink不适合与分页器一起使用。我刚刚编写了自己的jQuery操作,将ajax操作附加到分页链接。这些链接是此类要求的必读内容:
<script>         
$(document).ready(function() {
    $('#example').dataTable();
} );
</script>
<table class="display dataTable" id="exampledtable" >
            <thead>
                <tr>
                    <th>ID</th>
                    <th>Field1</th>
                    <th>Field2</th>
                    <th>Field3</th>
                </tr>
             </thead>
         <tbody><?php foreach ($this->entries as $entry): ?>
            <tr>
                <td><?php echo $this->escape($entry->ID) ?></td>
                <td><?php echo $this->escape($entry->field1) ?></td>
                <td><?php echo $this->escape($entry->field2) ?></td>
                <td><?php echo $this->escape($entry->field3) ?></td>
            </tr>
        <?php endforeach ?>
    </tbody>
</table>