vendredi 17 mars 2017

Filter results by dynamically added list of checkboxes

I am trying to filter a dataset. The filters are dynamically added via JSON.

The objects:

  • Books (Object arraylist)
  • Book_Genres (Object arraylist containing: book_id and genre_id)
  • Genres (Object arraylist)

Some core issues:

  • The dataset (Books) does not contain equal data (such as foreign keys)
  • There is another dataset that does contain equal data (Book_Genres)

  • The genres are dynamically added as a checkbox via ng-repeat

HTML:

 <div class="media" ng-repeat="book in Books | filter:filterByGenre">
                               
</div>
<div class="GenreItem" ng-repeat="genre in Genres"><input type="checkbox" "/><br/></div>

How is it possible to filter the Books list with the checkboxes? Note that it should be possible to check multiple checkboxes which would then result in a combination of conditions (filters).




Aucun commentaire:

Enregistrer un commentaire