-1

Here I am developing simple angular html form, I am using angular smart table. How can i clear smart table search filter after i click reset button

My html

<tr>
  <th></th>
  <th><input st-search="studentId" st-delay="1200" /></th>
  <th><input st-search="studentName" st-delay="1200" /></th>
  <th><filter-options code-id="200" search-field="studentType">
      </filter-options></th>
</tr>

<button id="cm-ResetBtn" name="cm-ResetBtn" type="button" ng-click="Reset()">Reset</button>

My angular code

$scope.Reset = function () { 
  //TODO
}
Vishwas Nahar
  • 418
  • 7
  • 21
sgl
  • 563
  • 1
  • 6
  • 16
  • You can examine bottom post and it worked for me! https://stackoverflow.com/questions/22447374/how-to-trigger-ngclick-programmatically – MahmutKarali Mar 27 '20 at 11:43

3 Answers3

0

I guess

JS

 $scope.Reset = function () {
        $scope.studentId = '';
        $scope.studentName = '';
}

HTML

Need to add ng-model attribute to inputs

<th><input ng-model="studentId" st-search="studentId" st-delay="1200" /></th>
<th><input ng-model="studentName" st-search="studentName" st-delay="1200" /></th>

JSFiddle example

Also you can check this question Smart Table not update when search filter value changes from javascript

Community
  • 1
  • 1
Leguest
  • 2,097
  • 2
  • 17
  • 20
0

I fixed by $state.reload(). That works as expected

sgl
  • 563
  • 1
  • 6
  • 16
0

You can examine Atkinson's post and it worked for me!

How to trigger ngClick programmatically

MahmutKarali
  • 339
  • 4
  • 8