0

I have a web application where I have many forms which i have created using bootstrap modal.

In my application I have a search textbox with filter button. When I am adding a text and filter the list as per that I get the result (for filter I am using ng-click=search('F') . The result has a edit and delete buttons for each. Now when I open the result data for editing(using edit button) then close it with top right "X" button the ng-click = reset() is called and the filtered values go off.

I want the the filtered values to remain even after i open the files for edit and close it. As the code is confidential I can just put up the code for "X" button

 <button type="button" class="close" data-dismiss="modal" aria-hidden="true" data-ng-click="Reset()">&times;</button>

the code for search filter button is:

 <button class="btn btn-primary" type="button" id="btnFilter" ng-click="Search('F')">
                                        &nbsp;&nbsp; Filter &nbsp;&nbsp;
                                    </button>

Hope I am clear. Please let me know if any other clarification required. I need help with this issue. Thanks in advance.

6
  • are you sure you are not clearing the search text box value inside your Reset() method ? Commented Apr 7, 2017 at 3:54
  • No. Because after I close the form the text remains in the search textbox. I need to click on filter button again to get the filtered value. I don't want to click on filter button again. even after i open and close the form the filtered values should remain. Commented Apr 7, 2017 at 3:55
  • Is it possible to call Search function inside reset function in angular js? Commented Apr 7, 2017 at 4:00
  • yes it is possible, but it is not the right approach. How have you implemented your search logic ? is it simple filter in ng-repeat like ng-repeat="item in items | filter:searchField" or some other custom logic where you are re-creating the list ? Also, what is the object structure of your list ? Commented Apr 7, 2017 at 4:06
  • Its other custom logic which recreates the list Commented Apr 7, 2017 at 4:09

1 Answer 1

2

If you are using custom search / filter logic and are re-creating the list after filter, then you will have to re-run your search / filter logic after you are done with your edit / delete functionality.

Had it been a simple ng-repeat filter, angular would have done it for you using 2-way binding and ng-repeat watchers.

But, in your case, call your search method at end of your edit and delete method

Sign up to request clarification or add additional context in comments.

3 Comments

You mean angular js reset function i should call search function?
yes call you search function at the end of you reset function
Also, mark this as an answer and give an up-vote, if this has solved your issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.