美文网首页
dataTable使用

dataTable使用

作者: IT_min | 来源:发表于2017-07-18 14:02 被阅读0次

var userTableAjax = function () {
var grid;
var gridRecords = function (url) {
grid = new Datatable();
grid.init({
src: $("#datatable_ajax"),
hashCode:'',
onSuccess: function (grid) {
},
onError: function (grid) {
},
csrf:$("#_csrf").val(),
loadingMessage: '加载中...',
hashCode: "prod_list",
dataTable: {
"bInfo": true,
"bStateSave": false,
"bSort": false,
"lengthMenu": [
[10, 20, 50],
[10, 20, 50]
],
"pageLength": 10,
"ajax": {
"url": url,
},
"dom": '<<t>pli>',
}
});
};
return {
init: function (url) {
gridRecords(url);
},reflash:function(){//刷新
grid.submitFilter();
}
};
}();

userTableAjax.init($url);

userTableAjax.reflash(); 的使用

dataTables
hashCode 保持查询条件(两个页面的hashCode相同时,从一个跳转到另一个页面时会保持查询条件)

<table class="table table-striped table-bordered table-hover" id="datatable_ajax">
<thead>
<以下被注释的代码 在列表头部添加查询条件的代码 若是无查询条件但是有如下的filter的代码,程序会报错>








<tr role="row" class="heading">
<th width="5%">序号</th>
<th width="20%">二级目的地名称</th>
<th width="20%">排序</th>
<th width="20%">操作</th>
</tr>
</thead>
<tbody>
</tbody>
</table>

相关文章

网友评论

      本文标题:dataTable使用

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