Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何在角度智能表格中更新过滤器_Angularjs_Smart Table - Fatal编程技术网

Angularjs 如何在角度智能表格中更新过滤器

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

我想存储智能表的最后一次搜索/筛选。这可以正常工作,但在重新加载时表不会更新过滤器

HTML格式的控制器:

<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();

    }]);