0

隐藏/显示分页我需要开发像 facebook 这样的分页,当您向下点击页面“显示更多”按钮时,该按钮单击了同一页面上的其他记录显示。也使用了 jquery + ajax。

谢谢

4

1 回答 1

1

你的控制器类看起来像:

class BooksController extends AppController
{
    var $components = array('RequestHandler');
    var $helpers = array('Html','Form','Javascript');
    var $paginate = array('order'=>array('Books.author'),'limit'=>'15');

        function list()
        {
                $data = $this->paginate();
                $this->set('books',$data);
        }

}
?>
The viewer class would be:
<?php
if (count($books)>0) {

?>
<div id="pagination">
<?php
      echo $paginator->prev(); 
      echo $paginator->numbers(array('separator'=>' - ')); 
      echo $paginator->next();
?>
</div>

<table>
<?php
      foreach ($books as $book) {
?>
   < tr >< td >.
function loadlist(href,divName) {    
    $(divName).load(href, {}, function(){
        var divPaginationLinks = divName+" #pagination a";
        $(divPaginationLinks).click(function() {     
            var thisHref = $(this).attr("href");
            loadlist(thisHref,divName);
            return false;
        });
    });
} 

<script type="text/javascript">
          $(document).ready(function() {
            loadlist("<?php echo $html->url(array('controller'=>'books','action'=>'list'));?>","#booklist");
             });
    </script>
<div id="booklist">

</div> 

您可以使用此链接: bakery.cakephp.org/articles/view/advanced-pagination-1-2 和http://develemental.com/posts/view/ajax-pagination-in-cakephp-using-a-jquery-滚动事件

于 2013-05-24T08:59:04.940 回答