angular1中的数据表不能显示lengthMenu

时间:2017-05-18 13:25:41

标签: angularjs datatables

我这里有一个愚蠢的问题,就是在吃我的一天。我正在显示角度datatablelengthMenu根本不起作用,一切似乎都很好。我在控制器中的代码

   $scope.dtOptions = DTOptionsBuilder.newOptions()
                .withDisplayLength(50)
                .withOption('order', [1, 'asc'])
                .withOption('bLengthChange', false)
                .withOption('searchable', [3, false])
                // .withOption('lengthMenu', [5, 100, 150, 200])
                .withPaginationType('full_numbers').withDisplayLength(5)
                .withOption('lengthMenu', [[5, 10, 15, 20, 25,-1],[5,10,15,20,25,"All"]])
                .withOption('notSortable', 2);

我的观点

<table datatable="ng" dt-options="dtOptions"
                 class="table table-striped table-hover dataTables-example" dt-column-defs="dtColumnDefs" >
                    <thead>
                        <tr>
                            <th>User Id</th>
                            <th>Name</th>
                            <th>Roles</th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="user in userList">
                            <td>{{ user.userId }} </td>
                            <td>{{ user.firstName }} {{ user.lastName }}</td>
                            <td>{{ user.role | displayRoleNames}}</td>
                            <td><span class="flex-inline">
                                <!--<a href="" title="View">View</a>   |   -->
                                <a  ui-sref="admin.edituser({id:user.userId})" title="Edit">Edit</a>   |   
                                <a href="" title="Ghost">Ghost</a> | 
                                <a href="" ng-click="deleteUser(user.userId,$index)" title="Delete">Delete</a>
                            </span></td>
                        </tr>
                    </tbody>
                </table>

0 个答案:

没有答案