var mytable = $(‘#datatables‘); mytable.dataTable( { "sDom": "<‘row-fluid‘<‘span6‘l><‘span6‘f>r>t<‘row-fluid‘<‘span6‘i><‘span6‘p>>", "sPaginationType": "bootstrap", "bProcessing": true, "bServerSide": true, "sAjaxSource": "/user/list", "aoColumns": [ { "mData": "Id" }, { "mData": "Username" }, {"mData":function(obj){ return obj.group; }}, {"mData":"yiyuan"}, {"mData":function(obj){ return obj.keshi; }}, {"mData":function(obj){ if(obj.Status==1){ return "使用中"; }else{ return "禁用"; } }}, {"mData": function(obj){ var del=""; if(isAdmin){ del=‘<a data-title="‘ + obj.Id + ‘" class="btn btn-danger"><i class="icon-wrench icon-white" ></i>删除</a>‘; } return ‘<a data-title="‘ + obj.Id + ‘" class="btn btn-success" href="#"><i class="icon-edit icon-white"></i>修改</a>‘ +‘ ‘+del; },bSortable : false} ], "fnDrawCallback": function(){ var oTable = $("#datatables").dataTable(); $(‘#redirect‘).keyup(function(e){ if($(this).val() && $(this).val()>0){ var redirectpage = $(this).val()-1; }else{ var redirectpage = 0; } oTable.fnPageChange( redirectpage ); }); } });
datatables增加跳转至指定页功能
时间: 2024-09-29 17:36:51