jquery UI dataTable



        this.dataTable = this.qid("datatable").dataTable({
            searching: false,
            serverSide: true,
            bProcessing: true,
            ordering: false,
            sDom: "t<ip>",
            "columns": [
                { "title": this.i18n.professionalname ,"mData":"professionName"},
               { "title": this.i18n.userCount ,"mData":"users", "sWidth": "10%" },
                { "title": this.i18n.namedisc ,"mData":"id", "sWidth": "35%"},
                { "title": this.i18n.handle,"mData":"id", "sWidth": 150 }
            ],
            "oLanguage": { //语言
                "sSearch": this.i18n.search,
                "sLengthMenu":this.i18n.everPage+" _MENU_ "+this.i18n.record,
                "sZeroRecords": this.i18n.message,
                "sInfo": this.i18n.from+" _START_ "+this.i18n.to+" _END_ /"+this.i18n.all+" _TOTAL_ "+this.i18n.allData,
                "sInfoEmpty": this.i18n.withoutData,
                "sInfoFiltered": "("+this.i18n.fromAll+"_MAX_"+this.i18n.filterRecord+")",
                "sProcessing": ""+this.i18n.searching+"...",
                "oPaginate": {
                    "sFirst": "<<",
                    "sPrevious": this.i18n.back,
                    "sNext": this.i18n.next,
                    "sLast": ">>"
                }
            },
            "fnServerParams": this.proxy(function (aoData) {
            var rule=[];
            if($.trim(this.nameContains.val())){
            rule.push([{"key":"name","op":"like","value":this.nameContains.val()}]);
            }
            $.extend(aoData,{
            "tokenid":JSON.parse($.cookie("uskyuser")).tokenid,
            "method":"stdcomponent.getbysearch",
            "dataobject":"userGroup",
            "rule":JSON.stringify(rule),
            "columns":JSON.stringify(aoData.columns),
            "search":JSON.stringify(aoData.search)
            },true);
            }),
            "fnServerData": this.proxy(function (sSource, aoData, fnCallBack, oSettings) {
            $.u.ajax({
                    url: $.u.config.constant.smsqueryserver,
                    type:"post",
                    dataType: "json",
                    cache: false,
                    type:"post",
                    async:false,
                    data: {
        tokenid:$.cookie("tokenid"),//JSON.parse($.cookie("uskyuser")).tokenid,//$.cookie("tokenid"),
        method:"getPorfessionUsers",//"stdcomponent.getbysearch",//stdcomponent.getbysearch 查询 //stdcomponent.update//stdcomponent.delete
        dataobject:"dictionary",
        "rule": JSON.stringify([[{"key":"type","value":"审计专业"}]]),
        }
                }).done(this.proxy(function (data) {
                debugger;
                    if (data.success) {
                        fnCallBack(data.data);
                    }
                })).fail(this.proxy(function (jqXHR, errorText, errorThrown) {


                }));
            
            }),
            "aoColumnDefs": [
                {
                    "aTargets": 1,
                    "mRender": function (data, type, full) {//(full.users, "display", full)
                       return "<a href='#' class='btn btn-link viewusers'  data='"+JSON.stringify(full)+"'>"+(data ? data.length : "0")+"</a>";


                    }
                },
                {
                    "aTargets": 2,
                    "mRender": function (data, type, full) {
                    var htmls=["<ul style='padding-left:15px;'>"];
                full.users && $.each(full.users,function(idx,user){
                htmls.push("<li userid="+user.userId+">"+user.userFullName+"</li>");
                });
                htmls.push("</ul>");
                        return htmls.join("");
                    }
                },
                {
                    "aTargets": 3,
                    "mRender": function (data, type, full) {
         
                    return  "<button type='button' class='btn btn-link editmembers' data='" + JSON.stringify(full) + "'>" + com.sms.professionalusers.professionalusers.i18n.editMember + "</button>"; 
      
                    }
                }
            ]
        });
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
jquery.datatable是一款常用的前端表格插件,它支持前端和后端分页两种方式。在后端分页的情况下,数据请求和处理都在服务器端完成,前端只需要展示和呈现数据。 在使用jquery.datatable进行后端分页时,我们需要进行以下步骤: 1.准备后端接口:需要在服务器端提供一个接口来处理数据请求。这个接口需要接受一些参数,例如当前页码、每页显示数量等。接口会根据这些参数查询数据库,并返回相应的数据结果。 2.前端配置datatable插件:在前端页面中,需要引入jquery.datatable的相应脚本文件,并配置datatable的参数。其中,重要的参数包括ajax配置项,用于指定后端接口的URL,以及服务器端接口需要的参数。 3.发送数据请求:当用户操作表格进行翻页或者其他操作时,jquery.datatable会根据配置的ajax参数自动发送数据请求到后端接口。请求参数中包含当前页码、每页显示数量等信息。 4.服务器处理请求:后端接口接收到数据请求后,根据请求参数进行相应的查询和处理操作。可以使用数据库查询语言等方式查询数据库,并返回结果给前端。 5.前端展示数据:jquery.datatable会自动根据后端返回的数据结果,生成对应的表格展示。同时,它还提供了丰富的功能和样式配置选项,使得表格的展示更加灵活和美观。 总结来说,使用jquery.datatable进行后端分页需要准备后端接口,配置前端datatable,并进行数据请求和处理。这样就能够实现在前端页面展示由后端数据查询而来的分页表格。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值