javascript - About the use of pagination plug-in in jquery
PHP中文网
PHP中文网 2017-05-16 13:05:56
0
1
511

I designed a small function using thinkphp3.2.3 and jquery's pagination plug-in.
The detailed design is that when I click "Expand" on the page, the records of the user list in the background are requested and displayed through pagination. Since I used the fetch command in thinkphp, I wrote a separate paging page. However, when actually running, although there is a paging bar on the page, all records are displayed on the page and there is no actual paging. May I ask you heroes what is the reason? Also ask: var newcxt = $('#result p:eq(+pi+)').clone(); What does +pi+ mean? The code is as follows:
Main html page:
<p">You have added 10 tags. -Click to expand-</p>
<p id="taglist"> < ;/p>
<script type="text/javascript">

 $(function(){
        $('#showtaglist').click(function(){
            $.post(
                    '{:U('Dongzuo/loadlist')}',
                    function($data){$('#taglist').html($data);}
                   );
            return false;
        });
    });

</script>

The html page called by fetch:
<p class="ppage"></p>
<p class="content">

<span class="spntip">Loading data...</span>

</p>

<p id="result">
    <volist name="users_list" id='vo'>
        <p class="xx_name">{$vo.user_name}</p>
    </volist>
</p>

<p class="ppage"></p>
<script type="text/javascript">
function initpagination()
{

var sumnum =$('#result p').length;
$(".ppage").pagination(sumnum,{num_edge_entries:10,callback:pscallback,items_per_page:10});

}
function pscallback(pi,jq)
{

var newcxt = $('#result p:eq(+pi+)').clone();
$('#content').empty().append(newcxt);
return false;

}
$(function(){initpagination();});
</script>

php controller page:

public function loadlist(){
    if(IS_AJAX){
                $users_info = M('users_info');
                $count = $users_info->count();
                $users_list = $users_info->select();
                $this->assign('users_list',$users_list);
                $html = $this->fetch('fenye:show_tag_list');
                $this->ajaxReturn($html);
                }
            }
PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
为情所困

It has been solved. I use the Jpages plug-in, which is much easier to use than the plug-in above.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template