没有样式化Jquery Datatable,并且在加载服务器端数据后搜索不起作用

时间:2015-01-28 07:22:57

标签: jquery datatables jquery-datatables

我有一个从服务器端加载数据的jquery数据表。

$(document).ready(function() {

    var oTable = $('#example').addClass( "dataTables_length" ).dataTable( {
        "sAjaxSource": "data.php",
        "aaSorting": [],
        "bProcessing": true,
        "bServerSide": true,
        "columnDefs": [ {
        "searchable": true
       } ],
     "aoColumns": [
        { "mData": "id", "sTitle": "ID", "bSortable": "true", "bSearchable": "true"},
        { "mData": "name","sTitle": "Name", "bSortable": "true" , "bSearchable": "true"}
        ],
      "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
        oSettings.jqXHR = $.ajax( {
       "dataType": 'json',
       "type": "POST",
       "url": sSource,
       "data": aoData,
       "success": fnCallback,
       "error": function (e) {
       console.log(e.message);
        }
     });
   }
 });
}

它正确加载数据,但问题是它没有<tr><th><td>的样式,而且搜索框也无效。我还有什么需要做的吗?

0 个答案:

没有答案