显示在角度数据表中加载消息

时间:2016-09-21 04:29:52

标签: angularjs datatables angular-datatables

控制器

  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>

enter image description here

此前,数据加载完全显示消息显示&#39;没有可用的数据表&#39;  所以我想显示正在加载的消息而不是“没有数据可用”#39;完全在数据表中加载数据之前的消息

1 个答案:

答案 0 :(得分:0)

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