0

I have a few 100 records obtained from database (exam results of students) and I filter the results based on few criteria like subject.

<tr ng-repeat="t in search.samplesfilter =  ( search.samples | filter:search.searchText | uniqueFilter:'subject' | orderBy:search.sorter:search.reverse) ">

I want to add another filter to show only students who passed.

I am not able to append the criteria using button click.

How I can add the extra criteria to default filter using button click?

Kindly help. Thanks in advance!

5
  • Wich framework do you use at backend? Commented Dec 21, 2015 at 22:10
  • I use mysql/pyhton. Response from backend is in json format. Commented Dec 21, 2015 at 22:12
  • I suppose you have your students in an array, and you have this array bound to the UI via ng-repeat or something of the sort. The simplest way to filter by pass/fail, would be to simply remove these items from the array. Optionally, you could copy your old array into a new one, in case the user does not want to filter anymore. In any event, it is hard to give you any assistance, if you don't share any code with us. Commented Dec 21, 2015 at 22:14
  • Sorry I did not not notice the code was not pasted properly. I will paste it again. Thanks you. Commented Dec 21, 2015 at 22:16
  • I recomend you write some class at your backend like 'StudentFilter'. And at student list page send your object with propeties to backend and sort it at backend. Commented Dec 21, 2015 at 22:20

1 Answer 1

0

Send to your backend:

filter = {score: 'passed'}

you can every time add new feature to this filter object, after that send it to backend serialize and use sorting and return result to frontend. I think it's easiest way.

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

Comments

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.