您的位置:首页 > 其它

DataTables之传递自定义属性(上传除draw,search等自定义的参数)

2017-03-15 09:26 357 查看
DataTables打开服务器模式,请求的方式是GET请求,请求的同时携带若干参数:



修改之前代码

$('#fillInfo').DataTable({
'order': [[0, "desc"]],
'lengthChange':false,
'bdestroy' : true,
'bRetrieve' : true,
'aoColumns' : [ {
name:"City",
title : "城市",
width:"10%"
}, {
name:"HName",
title : "医院",
width:"26%"
}, {
name:"HLevel",
title : "级别",
width:"12%"
}, {
name:"JudgeMan",
title : "卒中中心负责人",
width:"20%"
}, {
name:"JMTel",
title : "电话",
width:"20%"
}, {
name:"AreaID",
title : "评估表",
width:"12%"
}],
"serverSide" : true,
"ajax": "datatable_query",
'language' : {
'emptyTable' : '没有数据',
'loadingRecords' : '加载中...',
'processing' : '查询中...',
'search' : '<i class="fa fa-search" style="position:absolute; margin:30px 10px; color:#4f9cde;"></i>',
'lengthMenu' : '每页 _MENU_ 条',
'zeroRecords' : '没有数据',
'paginate' : {
'first' : '首页',
'last' : '末页',
'next' : '下页',
'previous' : '上页'
},
'info' : "第 _PAGE_ 页 / 总 _PAGES_ 页,共 _TOTAL_ 条数据",
'infoEmpty' : '没有数据',
'infoFiltered' : '(过滤总数 _MAX_ 条)'
}
});


修改过之后的代码:

$('#fillInfo').DataTable({
'order': [[0, "desc"]],
'lengthChange':false,
'bdestroy' : true,
'bRetrieve' : true,
'aoColumns' : [ {
name:"City",
title : "城市",
width:"10%"
}, {
name:"HName",
title : "医院",
width:"26%"
}, {
name:"HLevel",
title : "级别",
width:"12%"
}, {
name:"JudgeMan",
title : "卒中中心负责人",
width:"20%"
}, {
name:"JMTel",
title : "电话",
width:"20%"
}, {
name:"AreaID",
title : "评估表",
width:"12%"
}],
"serverSide" : true,
"ajax": {
"url": "datatable_query",
"data": function ( d ) {
d.areaid = $("#areaid").val();
}
},
'language' : {
'emptyTable' : '没有数据',
'loadingRecords' : '加载中...',
'processing' : '查询中...',
'search' : '<i class="fa fa-search" style="position:absolute; margin:30px 10px; color:#4f9cde;"></i>',
'lengthMenu' : '每页 _MENU_ 条',
'zeroRecords' : '没有数据',
'paginate' : {
'first' : '首页',
'last' : '末页',
'next' : '下页',
'previous' : '上页'
},
'info' : "第 _PAGE_ 页 / 总 _PAGES_ 页,共 _TOTAL_ 条数据",
'infoEmpty' : '没有数据',
'infoFiltered' : '(过滤总数 _MAX_ 条)'
}
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: