Angularjs 如何在角度智能表格中更新过滤器
我想存储智能表的最后一次搜索/筛选。这可以正常工作,但在重新加载时表不会更新过滤器 看 HTML格式的控制器:Angularjs 如何在角度智能表格中更新过滤器,angularjs,smart-table,Angularjs,Smart Table,我想存储智能表的最后一次搜索/筛选。这可以正常工作,但在重新加载时表不会更新过滤器 看 HTML格式的控制器: <div data-ng-controller="TestController"> <table class="table table-striped" data-st-safe-src="store.getItems()" data-st-table="displayedCollection"> <thead> <tr
<div data-ng-controller="TestController">
<table class="table table-striped" data-st-safe-src="store.getItems()" data-st-table="displayedCollection">
<thead>
<tr>
<th data-st-sort="lastname">Name</th>
<th data-st-sort="company">Company</th>
<th data-st-sort="customerno">Customer No.</th>
</tr>
<tr>
<th colspan="999">
<div class="row">
<div class="col-md-11">
<input type="search" data-ng-change="updateSearchPattern()" data-ng-model="search" placeholder="search" class="form-control" data-st-search="" />
<div class="col-md-1">
<button type="button" class="btn btn-danger btn-sm">
<span class="glyphicon glyphicon-remove"></span>
</button>
</div>
</div>
</div>
</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="row in displayedCollection" data-st-select-mode="single" data-st-select-row="row">
<td>{{row.lastname}}, {{row.surname}}</td>
<td>{{row.company}}</td>
<td>{{row.customerno}}</td>
</tr>
</tbody>
</table>
</div>
请参阅文档中的
在本地存储中持久化表状态
。这里有一个将应用过滤器的示例指令
testApp.controller('TestController',
['$scope', 'DataService',
function ($scope, service)
{
$scope.displayedCollection = [];
$scope.store = service.getStore();
$scope.updateSearchPattern = function()
{
service.setSearchPattern($scope.search);
};
$scope.search = service.getSearchPattern();
}]);