隐藏从左到右的响应式数据表行

时间:2019-06-17 11:35:33

标签: angularjs datatables angular-datatables

我正在研究AngularJS解决方案,并且正在使用datatables library创建响应表;其中一些应以阿拉伯语显示,因此当响应列必须从左向右隐藏时;我该怎么做?

下面是我的代码:

<table  datatable="ng" dt-options="vmAR.dtOptions" id="TableAR" class="table table-striped table-bordered">
   <thead>
       <tr>
           <th>العمود 1</th>
           <th>العمود 2</th>
           <th>العمود 3</th>
           <th  ng-hide="true">test</th>
      </tr>
   </thead>
   <tbody>
      <tr ng-repeat="object in List">
         <td>{{object.param1}}</td>
         <td ng-if="object.param2== '' " ng-bind="object.param3"></td>
         <td ng-if="object.param2!= '' " ng-bind="object.param2"></td>
         <td>{{object.param4}}</td>
         <td ng-hide="true">{{object.param5}}</td>
      </tr>
   </tbody>
</table>

AngularJS代码:

$scope.vmAR.dtOptions = DTOptionsBuilder.newOptions()
                    .withOption('paging', false)
                    .withOption('ordering', false)
                    .withOption('info', false)
                    .withOption('responsive', true);

基于this link,我尝试了以下操作,但无济于事,它仍然从右到左隐藏列:

$scope.vmAR.dtOptions = DTOptionsBuilder.newOptions()
                    //.withPaginationType('full_numbers')
                    .withOption('paging', false)
                    .withOption('ordering', false)
                    .withOption('info', false)
                    .withOption('responsive', true)
                    .withOption('columnDefs', [
                        { responsivePriority: 1, targets: -1 }
                    ]);

有什么建议吗?

更新

即使使用以下代码,它也不起作用:

$scope.vmAR.dtOptions = DTOptionsBuilder.newOptions()
                    //.withPaginationType('full_numbers')
                    .withOption('paging', false)
                    .withOption('ordering', false)
                    .withOption('info', false)
                    .withOption('responsive', true)
                    .withOption('columns', [
                        { responsivePriority: 3 },
                        { responsivePriority: 2 },
                        { responsivePriority: 1 },
                        { responsivePriority: 1 }
                    ]);

0 个答案:

没有答案
相关问题