AngularJS数据表始终显示未找到匹配记录

时间:2019-01-11 05:30:24

标签: angularjs datatable serverside-rendering

过去5天,我已经在我的angularJS数据表中尝试了几乎所有内容,这是代码段和输出,

HTML

 <table datatable="" dt-options="dtOptions" dt-columns="dtColumns" class="table small">
 <thead>
     //Tried including tr, th too and without them too
  </thead>
  <tbody>
  </tbody>
 </table>

在angularJS中

 //Dt options
        $scope.dtOptions = DTOptionsBuilder.newOptions().withOption('ajax', {
            dataSrc: function (json) {
                console.log(json);
                return json;
            },
            url: "/allserviceprovider",
            type: "POST"

        })
            .withOption('processing', true) //for show progress bar
            .withOption('serverSide', true) // for server side processing
            .withPaginationType('full_numbers') // for get full pagination options // first / last / prev / next and page numbers
            .withDisplayLength(10) // Page size
            .withOption('order', []) // for default sorting column // here 0 means first column
            //
            // .withOption('bJQueryUI', true);

        $scope.dtColumns = [
            DTColumnBuilder.newColumn('merchantName').withTitle('Merchant Name'),
            DTColumnBuilder.newColumn('serviceProviderName').withTitle('Service Provider')
        ];

服务器端的输出

{draw: 1, recordsTotal: 2, recordsFiltered: 2, data: Array(2)}
data: Array(2)
   0: (2) ["abc provider", "some name"]
   1: (2) ["Operator Merchant", "operator_unique"]
length: 2
draw: 1
recordsFiltered: 2
recordsTotal: 2

从chrome调试器(不是RAW JSON)复制

我确定此数据对于由数据表呈现的数据足够正确,我也尝试在data中返回数组数组和对象数组,但是仍然没有运气。可能出什么问题了?请帮助我,我已经有5天的时间了。

0 个答案:

没有答案