我正在使用自定义过滤,因为此答案显示在https://stackoverflow.com/a/29608444/3883369
中这是我的代码
<th field-name="FileName" display-name="{{ 'FileName' | translate }}">
<div class="tr-ng-column-filter tableHeaderOverTitleElement">
<input class="form-control"
ng-model="filtersWrapper.mFileName" value=""
placeholder="{{'refNoAndFilename'|translate}}"
ng-enter="makeFilteredCallWithDefaultData()">
</div>
<div class="tr-ng-title">{{ 'FileName' | translate }}</div>
</th>
不幸的是,在添加自定义过滤后,默认排序消失了。你能帮忙整理一下吗?
我正在使用TrNgGrid版本3.1.7
答案 0 :(得分:0)
创建用户定义搜索输入
div class="container" style="padding-left: 0px;">
<form>
<div class="form-group" style="margin-bottom: 0px;">
<div class="input-group" style=" margin-left: 15px;">
<div class="input-group-addon" style=" padding-left: 15px;"><span> Filter </span></div>
<input type="text" class="form-control" placeholder="Type here..." ng-model="searchFish" style="width: 92%;">
</div>
</div>
</form>
</div>
简短记录
<table class="table table-bordered table-striped" id="myTable" style=" width: 99%;max-width: 93%; text-align: center;" >
<thead>
<tr>
<th style="border: 0px solid #ddd;" class="textbgcolor textcenter"> user id # <img src="img/up.svg" style="width: 13px;" ng-click="orderProperty = 'user_id'"/> </th>
</tr>
</thead>
<tbody>
<tr ng-repeat="t in current_table | orderBy:orderProperty | orderBy:use_id | filter:searchFish ">
<td style=" border: 0px solid #ddd;"> {{t.use_id}} </td>
</tr>
</tbody>
</table>
它是直接使用的功能
//========================================================== asssending and discending oreder funcation
$scope.setOrderProperty = function(propertyName) {
if ($scope.orderProperty === propertyName) {
$scope.orderProperty = '-' + propertyName;
} else if ($scope.orderProperty === '-' + propertyName) {
$scope.orderProperty = propertyName;
} else {
$scope.orderProperty = propertyName;
}
}
// -=====================================================
$scope.sortType = 'x.user_id' // set the default sort type
$scope.sortReverse = false; // set the default sort order
$scope.searchFish = ''; // set the default search/filter term