javascript - Grid filtering pass result to function -


on page fiddle have grid.

in $scope.myitems have data.

i want observe data. after type in name field "enos", want records contain string ("enos").

the grid works, want print data using console log, because after filtering data want pass data function.

i tried use $scope.watch it's not working.

      .module('myapp', ['trnggrid'])     .controller("mainctrl", ["$scope", function ($scope) {         $scope.myitems = [{name: "moroni", age: 50},                  {name: "tiancum", age: 43},                  {name: "jacob", age: 27},                  {name: "nephi", age: 29},                  {name: "enos", age: 99}];          $scope.$watch('myitems', function(newvalue) {        console.log(newvalue);   });         }]);  

when type sth field console log isn't working.

answer can found documentation http://moonstorm.github.io/trnggrid/release/#/globaloptions

<table tr-ng-grid items="myitems" filtered-items="myfiltereditems"></table>  $scope.myfiltereditems = []; $scope.$watchcollection('myfiltereditems', function(items){   console.log(angular.tojson(items)); }); 

Comments

Popular posts from this blog

html - height not adding height to a empty div -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

python - Robot Framework location and name of keyword -