gpt4 book ai didi

Zend Framework 中的 AJAX 分页

转载 作者:行者123 更新时间:2023-12-04 21:26:06 26 4
gpt4 key购买 nike

如何使用 Zend_Framework 显示 AJAX 分页数据?

  • 是否有使用 paginationControl() 的好例子? , ajaxLink()ajaxContext() helper ?
  • 你会分享你的实现吗?
  • 最佳答案

    您可以使用带有简单分页的表格:
    https://www.datatables.net/

    这是一个例子:

    Controller :

    <?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();
    }
    }

    看法 :
    <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>

    关于Zend Framework 中的 AJAX 分页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3043871/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com