jquery UI dataTable

来源:互联网 发布:mysql函数大全 编辑:程序博客网 时间:2024/04/30 05:14


        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