Filter Form
Learn how we can apply filters on a set of book records.
In our book list view again, let’s look at a mechanism to filter the records that are returned from the REST API. Instead of only being able to show the full list of books, our application will also have the ability to selectively query the database to only display books that meet the search criteria.
About the application
In this application, we’ll look at how we can apply a filter when displaying book records. We want to filter out the books so that only relevant books, related to a chosen field, appear in the book list. For that, we have a BooksFilterVu
component that provides our application with certain fields to filter out the relevant books.
This is what the application looks like:
Note: To log in, use the username
admin
and password123
.
Copyright (c) 2020 John Sheehan Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.