La tabla inteligente no se actualiza cuando el valor del filtro de búsqueda cambia de javascript [duplicado]
Esta pregunta ya tiene una respuesta aquí:
¿Cómo integrar Smart Table `st-search` con ng-model? 1 respuestaestoy usandoMesa angular inteligente. Mientras estoy usando filtros de búsqueda usando la directiva st-search, cuando cambio su valor de la tabla javascript no obtengo actualizaciones. aqui esta mi codigo
Aquí está mi controlador
angular.module('myApp', ['smart-table'])
.controller('mainCtrl', ['$scope', '$timeout',
function ($scope, $timeout) {
var nameList = ['Pierre', 'Pol', 'Jacques', 'Robert', 'Elisa'];
var familyName = ['Dupont', 'Germain', 'Delcourt', 'bjip', 'Menez'];
$scope.isLoading = false;
$scope.rowCollection = [];
function createRandomItem() {
var
firstName = nameList[Math.floor(Math.random() * 4)],
lastName = familyName[Math.floor(Math.random() * 4)],
age = Math.floor(Math.random() * 100),
email = firstName + lastName + '@whatever.com',
balance = Math.random() * 3000;
return {
firstName: firstName,
lastName: lastName,
age: age,
email: email,
balance: balance
};
}
$scope.columns = ['firstName', 'lastName', 'age', 'email', 'balance'];
for (var i = 0; i < 10; i++) {
$scope.rowCollection.push(createRandomItem());
}
$scope.changeSearch = function () {
document.getElementById('firstName').value = '';
};
}
]);
Aquí está el html
<body ng-controller="mainCtrl">
<div class="table-container">
<table st-table="rowCollection" class="table table-striped">
<thead>
<tr>
<th ng-repeat="col in columns" st-sort="{{col}}">{{col}}</th>
</tr>
<tr>
<th>
<input st-search="firstName" id="firstName"
placeholder="search for firstname"
class="input-sm form-control"
type="search" />
</th>
<th colspan="4">
<input st-search placeholder="global search"
class="input-sm form-control"
type="search" />
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in rowCollection">
<td ng-repeat="col in columns">{{row[col]}}</td>
</tr>
</tbody>
</table>
<button ng-click="changeSearch()">Change Search</button>
</div>
<div ng-show="isLoading" class="loading-indicator"></div>
<script src="angular.min.js"></script>
<script src="smart-table.min.js"></script>
<script src="app2.js"></script>
Tomé un botón y en su método de clic cambia el valor del filtro de búsqueda, su valor cambia pero la tabla no se filtra. ¿Necesitas ayuda? ¿Es posible cambiar el valor de los filtros de búsqueda del código?