datatable问题,页码不显示

图片说明

为什么查询出来八条数据,显示的是从0至0项结果,而且还没有页码

2个回答

你前台是不是写错了! 或者没查询总数啊?

查询总数了,不然怎么会有图片中的”有8项结果过滤“ 。可能前台写错了 但是错到哪里 ?

$(document).ready(function() {
talent_table=$("#talent_table").DataTable({
"processing": true,

"pageLength": 6,

"destroy": true,

"serverSide": true,
"ordering": false,
"autoWidth": false,
"searching": false,
"lengthChange": false,
"pagingType": "full_numbers",
"ajax": "<%=basePath%>talent/getTalentList.do",
"language": {
"sProcessing": "处理中...",
"sLengthMenu": "显示 MENU 项结果",
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第 STARTEND 项结果,共 TOTAL 项",
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
"sInfoFiltered": "(有 MAX 项结果过滤)",
"sInfoPostFix": "",
"sSearch": "搜索:",
"sUrl": "",
"sEmptyTable": "表中数据为空",
"sLoadingRecords": "载入中...",
"sInfoThousands": ",",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上页",
"sNext": "下页",
"sLast": "末页"
}
},
"columns":[
{"data" : "TALENT_ID" ,"title" : "", "className" : "center", "width" : "1%"},
{"data" :"TALENT_ID","title" : "排序","className":"center"},
{"data" : "TALENT_NAME","title" : "人才名称" ,"className" : "center"},
{"data" :"TALENT_IDENTITYNUM","title" : "身份证号","className":"center"},
{"data" : "TALENT_SEX","title" : "人才性别" ,"className" : "center"},
{"data" :"TALENT_BIRTHDAY","title" : "出生年月","className":"center"},
{"data" :"TALENT_AGE","title" : "年龄","className":"center"},

{"data" :"TALENT_NATION","title" : "民族","className":"center"},
{"data" : "TALENT_BIRTHPLACE","title" : "出生地" ,"className" : "center"},
{"data" :"TALENT_ORIGINPLACE","title" : "籍贯","className":"center"},
{"data" : "POLITICAL_STATUS","title" : "政治面貌" ,"className" : "center"},
{"data" :"JOINPARTY_DATE","title" : "入党时间","className":"center"},
{"data" :"TALENT_ID","title" : "操作","className":"center"},
],
"columnDefs" :[
{
"targets":[0],
"render":function (data,type,full,meta){
TALENT_ID =data;
return '';
}
},
{
"targets":[1],
"render":function(data,type,full,meta){
TALENT_ID=data;
return TALENT_ID==null ?'' :TALENT_ID;
}
},
{
"targets":[2],
"render":function(data,type,full,meta){
TALENT_NAME=data;
return TALENT_NAME==null ?'' :TALENT_NAME;
}
},
{
"targets":[3],
"render":function(data,type,ful,meta){
TALENT_IDENTITYNUM=data;
return TALENT_IDENTITYNUM==null ?'' :TALENT_IDENTITYNUM;
}
},
{
"targets":[4],
"render":function(data,type,full,meta){
TALENT_SEX=data;
if(TALENT_SEX==0){
return "男";
}else if(TALENT_SEX==1){
return "女";
}else{
return "未知";
}

                                                }
                                        },
                                        {
                                                "targets":[5],
                                                "render":function(data,type,full,meta){
                                                    if(data==null){
                                                        return '';
                                                    }else{
                                                            TALENT_BIRTHDAY=(data.year+1900)+'年'+(data.month+1)+'月';
                                                            return TALENT_BIRTHDAY;
                                                    }   
                                                }
                                        },
                                        {
                                                "targets":[6],
                                                "render":function(data,type,full,meta){
                                                    TALENT_AGE=data;
                                                    return TALENT_AGE==null ?'' :TALENT_AGE;
                                                }
                                        },
                                        {
                                                "targets":[7],
                                                "render":function(data,type,full,meta){
                                                    TALENT_NATION=data;
                                                    return TALENT_NATION==null ?'' :TALENT_NATION;
                                                }
                                        },
                                        {
                                                "targets":[8],
                                                "render":function(data,type,full,meta){
                                                    TALENT_BIRTHPLACE=data;
                                                    return TALENT_BIRTHPLACE==null ?'' :TALENT_BIRTHPLACE;
                                                }
                                        },
                                        {
                                                "targets":[9],
                                                "render":function(data,type,full,meta){
                                                    TALENT_ORIGINPLACE=data;
                                                    return TALENT_ORIGINPLACE==null ?'' :TALENT_ORIGINPLACE;
                                                }
                                        },
                                        {
                                                "targets":[10],
                                                "render":function(data,type,full,meta){
                                                    POLITICAL_STATUS=data;
                                                    return POLITICAL_STATUS==null ?'' :POLITICAL_STATUS;
                                                }
                                        },
                                        {
                                                "targets":[11],
                                                "render":function(data,type,full,meta){
                                                    if(data==null){
                                                    return '';
                                                    }else{
                                                            JOINPARTY_DATE=(data.year+1900)+'年'+(data.month+1)+'月';
                                                            return JOINPARTY_DATE;
                                                    }
                                                }
                                        },
                                        {
                                                "targets":[12],
                                                "render":function(data,type,full,meta){
                                                    TALENT_ID=data;
                                                    return  '<a  class="btn btn-minier btn-success" title="查看" onclick="view(\''+TALENT_ID+'\');"  data-placement="left"><span ><i class="glyphicon glyphicon-eye-open"></i></span></a>'
                                                                +'<a  class="btn btn-minier btn-info" title="编辑" onclick="edit(\''+TALENT_ID+'\');"  title="" data-placement="left"><span ><i class="glyphicon glyphicon-edit"></i></span></a>'
                                                                +'<a  class="btn btn-minier btn-danger" title="删除" onclick="deleteTalentById(\''+TALENT_ID+'\');"  title="" data-placement="left"><span ><i class="glyphicon glyphicon-trash"></i></span></a>';
                                                }
                                        }],
                                    "fnDrawCallback": function() {
                                    var api = this.api();
                                    var startIndex= api.context[0]._iDisplayStart;// 获取到本页开始的条数
                                    api.column(1).nodes().each(function(cell, i) {
                                        cell.innerHTML = startIndex + i + 1;
                                    });
                                }
                        });
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐