对角度“数据表”中的列进行排序

2024-05-24

我创建了表

<table class="table table-striped table-bordered table-hover" width="100%" datatable="ng" dt-options="options">
<thead>
<tr>
    <th> Nannie ID</th>
    <th> Name</th>
    <th> Last name</th>
    <th> Email</th>
</tr>
</thead>
<tbody>
<tr class="" ng-repeat='item in items'>
    <td><a ui-sref="admin.nanniesEdit({id:item.id})">id{{item.id}}</a></td>
    <td>{{item.profile.name}}</td>
    <td>{{item.lastname}}</td>
    <td>{{item.profile.email}}</td>
</tr>
</tbody>

加载第一列顺序的表:

NannieID
id1 
id10    
id12    
id13    
id2 
id3 
id5 

我希望每次点击重新排序以及首次加载时获得正确的顺序。 预期结果:

NannieID
id1 
id2 
id3 
id5 
id10    
id12    
id13    

我添加了这段代码,但它仅在加载表格时有帮助,单击重新排序列后,我得到了错误的顺序

$scope.options = DTOptionsBuilder.newOptions().withOption('aaSorting', [[5, 'asc']])

请帮我


改变aaSorting to order。你的代码将是这样的:

$scope.options = DTOptionsBuilder.newOptions().withOption('order', [[5, 'asc']])
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

对角度“数据表”中的列进行排序 的相关文章

随机推荐