【问题标题】:show Loading message in angular datatable在角度数据表中显示加载消息
【发布时间】:2016-09-21 04:29:52
【问题描述】:

控制器

  app.controller('myController', ['$scope', 'dashboardService', 'DTOptionsBuilder', function ($scope, dashboardService, DTOptionsBuilder) { 
   $scope.dtMasterOptions =
    DTOptionsBuilder.newOptions()       
    .withDisplayLength(10)
    .withOption('bLengthChange', true)
    .withPaginationType('full_numbers')
    .withBootstrap();       
   $scope.ViewData = function () {       
    var getData = dashboardService.getAllSubmitted();
    getData.then(function (job) {
        $scope.submitedjob = job.data;            
    },
    function (response) { document.write(response.status + "<br/>" + response.data); });
} 
 }]);

html代码

       <table style="width:100%;" ng-controller='myController'>
        <tr>
        <td align="center" style="padding:25px;" ng-init=" ViewData();">
            <table datatable="ng" dt-options="dtMasterOptions" class="table table-striped table-bordered" ng-cloak>
                <thead>
                    <tr>
                        <th class="text-danger" style="width:5%;">S. No.</th>
                        <th style="width:10%;">Applicant ID</th>
                        <th style="width:15%;">Email</th>
                        <th style="width:15%;">Full Name</th>
                        <th style="width:10%;">Contact No</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="x in submitedjob" ng-if="x.SubmittedStatus==='Submitted'">
                        <td>{{$index + 1}}</td>
                        <td>{{x.ApplicantID}}</td>
                        <td>{{x.Username}}</td>
                        <td>{{x.Salutation}} {{x.Firstname}} {{x.Middlename}} {{x.Lastname}}</td>
                        <td>{{x.Mobile}}</td>                            
                    </tr>
                </tbody>
            </table>
        </td>
    </tr>
</table>

在数据完全加载之前,这里的消息显示“没有可用的数据表” 所以我想在数据完全加载到数据表之前显示加载消息而不是“无可用数据”消息

【问题讨论】:

标签: angularjs datatables angular-datatables


【解决方案1】:

withOption('processing', true) 添加到您的DTOptionsBuilder.newOptions(),它应该会显示正在加载消息。

【讨论】:

  • 感谢@Deendayal 的回复,但我已经尝试过它不起作用
  • 感谢它的有用示例,但是当我尝试像 DTOptionsBuilder.fromSource(job.data) 一样传递并从正确的列名给出然后没有显示任何内容时,为什么会这样?
  • 您缺少data1.json 文件。检查这个。 plnkr.co/edit/sYRSHURwsGsixPkVfhCM?p=preview
  • 不,我想传递 DTOptionsBuilder.fromSource(dataPara) 而不是文件名 请检查我的 dataPara 变量,因为我的数据来自对象,所以我想传递 'dataPara' 而不是文件名
猜你喜欢
  • 2019-07-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-04-10
  • 2014-11-08
  • 2021-06-04
  • 1970-01-01
相关资源
最近更新 更多