CI中的ajax jquery分页错误

 金健winner 发布于 2023-02-11 15:26

在codeigniter中jquery分页出错.

    if per_page=5;
    total number 6 and total page 2

    but the pagination like below

    Showing 6 to 6 of 6 |  < 1 2
    But only 5 is shown and last one show in 2nd page.

嗨朋友,我陷入了这个bug.这个节目在每一页.Pls给我一个解决方案,以获得正确的分页

下面的代码正在使用:

            $config['base_url'] = site_url('settings/view_leave_reason_ajax/');
        $config['total_rows'] = $this->leav->getLvReasonCount();
        $config['per_page'] = 5;        
        $config['anchor_class'] = 'ajax_links';
        $config['show_count'] = true;
        $config['div'] = '#list_view';
        $this->jquery_pagination->initialize($config);
        $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
        $data["links"] = $this->jquery_pagination->create_links();
        $data['page'] = $page;
        $data['result'] = $this->leav->getLvReason($config["per_page"], $page);

关于以下ci分页的问题:

https://github.com/neotohin/CodeIgniter-Ajax-pagination-Library

查看页面:


                
                    
                        No Details Exist
                    
                
                
                
                    
                    
                    
                    

                            hrm->encData($row['id']); ?>" >
                       
                
                
                
                    
                        
                    
                
                

                

Nouphal.M.. 5

你定义了

 $config['div'] = '#list_view';

在您的配置中,但您尚未在视图中定义该容器.因此,不会发送任何ajax调用.

所以不要这样


尝试将容器放在

下面:

也在分页库中 Jquery_pagination.php

改变这一行的line number 184,从

if( ( $curr_offset + $this->per_page ) < ( $this->total_rows -1 ) )

if( ( $curr_offset + $this->per_page ) <= ( $this->total_rows -1 ) )

它会工作......

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有