Javascript - Search data on click event of button using smart table - Stack Overflow
Search data on click event of button using smart table
I am very new to the smart table. I have gone through its documentation on Smart Table. But the I haven't found how to bind data on click event in smart table? Code is very big but I am trying to post it here.
and my js code is here.
But It is working fine with the direct search on textbox. but according to the requirement I have to perform it on button click. Your suggestions and help would be appreciated. Thanks in advance.
1 Answer 1
You can search for a specific row by making some simple tweaks.
- add a filter to the ng-repeat , and filter it by a model that you will insert on the button click, like so:
- in your view, add that model (using ng-model ) to an input tag and define it in your controller
- then pass the value to the filter when you click the search button
here's a plunk that demonstrates this
you can use filter:searchQuery:true for strict search
EDIT:
OK, so OP's big problem was that the filtered values wouldn't show properly when paginated, the filter query is taken from an input box rather then using the de-facto st-search plug-in, So I referred to an already existing issue in github (similar), I've pulled out this plunk and modified it slightly to fit the questioned use case.
Comments
Post a Comment