M
M
Messi2018-01-29 19:56:40
Yii
Messi, 2018-01-29 19:56:40

An example or how to implement filtering in Yii2?

Hello! There is a task, you need to implement a filter with a search on the page (Yii2).
As I plan to:
Create an Item, ItemSearch, ItemController model, add a form with a search field and a list of items (red, blue, etc.) to the index. But what to do next? How to pass the selected filters to the search model?
$dataProvider and $searchModel are in actionIndex.
5a6f51cee5b89599467849.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2018-01-29
@FitTech

You haven't provided enough data. Therefore, let's say you have a table (Item) with data and there is a color field.
Open gii and generate an Item model for it, then generate a CRUD for that model, specifying what will be search. As a data display, for starters, let it even be GRID.
Thus, you will get all the insides for work, and you will only have to work with the view, arrange it the way you drew in the picture.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question