如何设置为记住所选过滤器并在刷新或重新打开页面后打开行。如果有人过滤搜索TEST1,并打开行,返回或刷新页面后如何再次获取此数据?
我尝试this将参数保存到会话存储中,但是如何保存和打开行呢?
有什么办法吗?
thnx
这是我的代码
angular.module("uCloud", ["ngTable"])
.controller("myController", ['$scope', 'NgTableParams',
function($scope, NgTableParams) {
$scope.tableParams = new NgTableParams({
count: 3,
page: 1,
}, {
dataset: [{
name: "teste1",
description: "testando1"
}, {
name: "teste2",
description: "testando2"
}, {
name: "teste3",
description: "testando3"
}, {
name: "teste4",
description: "testando4"
}],
});
}
]);
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://unpkg.com/ng-table@3.0.1/bundles/ng-table.min.js"></script>
<body>
<div ng-app="uCloud" class="container-fluid">
<div class="row">
<div class="col-md-3" ng-controller="myController">
<h3>ngTable</h3>
<form class="form-inline">
<div class="form-group">
<label>Search</label>
<input type="text" ng-model="search" class="form-control button_pv" placeholder="Search">
</div>
</form>
<table ng-table="tableParams" class="table table-condensed table-bordered table-striped">
<tbody ng-repeat="bench in $data | filter:search">
<tr style="margin-bottom: 10px; background-color: rgba(255, 255, 255, 0.034)">
<td href="" ng-click="group.$hideRows = !group.$hideRows">
<a>
<span class="glyphicon" ng-class="{ 'glyphicon-chevron-right': !group.$hideRows, 'glyphicon-chevron-down': group.$hideRows }"></span>
</a>
</td>
<td align="center">Test1</td>
<td align="center">Test2</td>
<td align="center">Test3</td>
</tr>
<tr ng-hide="!group.$hideRows">
<td>Test</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>