2017-09-23 5 views
0

私はバックエンドで大きなデータを処理するためにdatatableを使用しました。 DTOptionsBuilderでは、withFnServerDataメソッドを使用して、データベースから一連のデータを取得します。テーブルのすべてを最初から最後まで解析しました。しかし、以下のページ番号は常に1つでした。動作していないように見えますが、左上の数字のフィルタのみを使用できますが、私が望むものではありません。次のボタンをクリックするとサーバーのプロセスデータテーブルが連続的に表示される

コントローラ

$scope.dtColumns = [ 
    DTColumnBuilder.newColumn('d', 'column').withOption('defaultContent', ""), 
    DTColumnBuilder.newColumn('m', 'mukim').withOption('defaultContent', ""), .... 
]; 

$scope.pageData = { 
     total: 0 
}; 

var get = function(sSource, aoData, fnCallback, oSettings){ 
     var draw = aoData[0].value; 
     var order = aoData[2].value; 
     var start = aoData[3].value; 
     var length = aoData[4].value; 

     var params = { 
      start:start, 
      limit:length 
     }; 

     ValuationService.SearchValuation(params, function(result, response){ 
     if(result == true){ 
      var records = { 
        'draw': 0, 
        'recordsTotal': 0, 
        'recordsFiltered': 0, 
        'data': [] 
      }; 
      if(response.result){ 
        records = { 
        'draw': draw, 
        'recordsTotal': response.total_data, 
        'recordsFiltered':response.result.length, 
        'data': response.result 
       }; 
      } 
      $scope.pageData.total = response.total_data; 

      fnCallback(records); 
     } 
     }); 
} 

$scope.dtOptions = DTOptionsBuilder.newOptions() 
     .withFnServerData(get) // method name server call 
     .withDataProp('data')// parameter name of list use in getLeads Fuction 
      .withOption('processing', true) // required 
      .withOption('serverSide', true)// required 
      .withOption('paging', true)// required 
      .withPaginationType('full_numbers') 
     .withDisplayLength(10) 
     .withOption('rowCallback', rowCallback) 
     .withDOM('lrtip'); 

function rowCallback (nRow, aData, iDisplayIndex, iDisplayIndexFull) { 
    $compile(nRow)($scope); 
} 

HTML私が欲しいもの

table.row-border.hover(datatable="", dt-instance="dtInstance",dt-columns="dtColumns", dt-options="dtOptions" style="overflow:auto;") 

The table below will show the number of pagination. I can click the next and previous. When I click next, it will call the API again to retrieve and parse another start to limit into table. 

最新号の私のデータはない全てのデータを示し、濾過したため、問題は、フィルタデータ部に位置し

Table pagination shows '1' only, next button disabled. 

I can solve the issue by select the number at top left corner, but it shown in one page which I don't want. 

enter image description here

答えて

0

。レコードを変更するだけで、フィルタリングされた全データが問題を解決します。

records = { 
    'draw': draw, 
    'recordsTotal': response.total_data, 
    'recordsFiltered':response.total_data, // Change total_data 
    'data': response.result 
};