美文网首页
dataTable 异步查询

dataTable 异步查询

作者: _嘿嘿_ | 来源:发表于2018-06-25 11:07 被阅读0次

$.fn.dataTable.ext.errMode = function(s,h,m){};
$('#replace_tbody').dataTable({
"ajax": {
"url": "/tis/api/getPartPageReplacementsByDhhPart",
"type": "GET",
"async": true,
"data": {partCode:partCode},
"dataSrc": function(data){
return data.data.replaces;
}
},
"serverSide": true,
searching:false, //去掉搜索框
bLengthChange:false,//去掉每页多少条框体
language:Pagecommon.datatableLanguage,
destroy:true,
"pageLength":1,
"aoColumnDefs": [ { "bSortable": false, "aTargets": [0] }],
"order": [[ 1, "desc" ]],
"columns": [
{data: "index", render: function(data, type, row) {
return "<td><span class='index'>"+data+"</span></td>"; }
},
{data: "oldCode", render: function(data, type, row) {
return "<td><span class='oldCode'>"+data+"</span></td>"; }
},
{data: "newCode", render: function(data, type, row) {
if(row.type == 'G'){
return "<td ><a href='javascript:;' class='font-blue'"+
"onclick='pageSearch.operateModel(this)'> 组替换详情 </a>"+
"<p class='newCode' style='display:none'>"+row.gropCode+"</p></td>";
}else {
return "<td ><a href='javascript:;' class='font-blue'"+
"onclick='pageSearch.operateModel(this)'> "+data+" </a>"+
"<p class='newCode' style='display:none'>"+row.gropCode+"</p></td>";
}}
},
{data: "", render: function(data, type, row) {
if(row.type == 'G'){
return "<td><i class='glyphicon glyphicon-ok'" +
" style='color:#ba0808;'></i></td>";
}else {
return "<td><i style='color:#ba0808;'></i></td>";
}}
},
{data: "type", render: function(data, type, row) {
return "<td >"+data+"</td>"; }
},
{data: "date", render: function(data, type, row) {
return "<td >"+data+"</td>"; }
},
{data: "remark", render: function(data, type, row) {
return "<td >"+data+"</td>"; }
},
{data: "", render: function(data, type, row) {
return "<td><a href='javascript:;' " +
"class='font-blue'onclick='pageSearch.operateModel(this)'> 详情 </a></td>"; }
}
]
});

相关文章

网友评论

      本文标题:dataTable 异步查询

      本文链接:https://www.haomeiwen.com/subject/dhoeyftx.html