- function doSearch() {
- if(dtable!=null){
- dtable.fnClearTable(0);
- dtable.fnDraw(); // 重新加载数据
- }else{
- dtable = $("#datatable_ajax").dataTable({ //<span style="font-family: Arial, Helvetica, sans-serif;">datatable_ajax表单的id</span>
- "oLanguage" : { // 汉化
- "sLengthMenu": "每页显示 _MENU_条",
- "sZeroRecords": "没有找到符合条件的数据",
- "sProcessing": "加载中...",
- "sInfo": "当前第 _START_ - _END_ 条 共计 _TOTAL_ 条",
- "sInfoEmpty": "没有记录",
- "sInfoFiltered": "(从 _MAX_ 条记录中过滤)",
- "sSearch": "搜索:",
- "oPaginate": {
- "sFirst": "首页",
- "sPrevious": "前一页",
- "sNext": "后一页",
- "sLast": "尾页"
- }
- },
- "bStateSave" : false,
- "bJQueryUI" : true,
- "bPaginate" : true,// 分页按钮
- "bFilter" : false,// 搜索栏
- "bLengthChange" : false,// 每行显示记录数
- "iDisplayLength" : 10,// 每页显示行数
- "bSort" : false,// 排序
- "bInfo" : true,// Showing 1 to 10 of 23 entries 总记录数没也显示多少等信息
- "bWidth" : true,
- "bScrollCollapse" : true,
- "sPaginationType" : "full_numbers", // 分页,一共两种样式 另一种为two_button // 是datatables默认
- "bProcessing" : true,
- "bServerSide" : true,
- "bDestroy" : true,
- "bSortCellsTop" : true,
- "sAjaxSource" :currprojectname +"/aa/list.do", //所要请求的接口地址
- "sScrollY": "100%",
- "fnInitComplete": function() {
- this.fnAdjustColumnSizing(true);
- },
- "fnServerParams" : function(aoData) { //查询条件的接口拼接
- aoData.push({
- "name" : "aa",
- "value" : a
- });
- aoData.push({
- "name" : "cc",
- "value" : encodeURI($("#aaa").val())
- });
- },
- "aoColumns" : [
- {"mData" : "id"}, //表单的属性,必须一一对应而且行数必须相同!!!
- {"mData" : "name"},
- {"mData" : "lal"},
- {"mData" : "dota2"},
- {"mData" : "games"},
- ],