most of peoples use arrayDataprovider.So when we show data in grid,it fines but when we implement filter and sorting then they dont works,Even no documentation from yii developer team.
Yii has no feature so we can add extra filters on activedataProvider and we can implement same on arraydataProvider.
Where have you read that most of peoples use ArrayDataProvider?
I think that most people use ActiveDataProvider, or they should use ActiveDataProvider instead ArrayDataProvider.
I am not sure where you got that information from
Gii will generate filter and search for you if you tell it to.
And there are tons of examples of filtering and sorting with grids in Yii.
If you need help, ask.
I don’t say that you should not use ArrayDataProvider, it’s true that you sometimes have to use it unwillingly. I would avoid using it if I could. From my own experience, it is very hard to write a simple and elegant code using ArrayDataProvider when you want a good performance.
If your data source is very custom such as API, it’s better to implement your own provider.
may be i m wrong but i searched on google.every one has tried implement search filters on arraydataprovider.but not one has good idea.
ok then why this is not mentioned in yii2 docs related to arraydataprovider.
i implemented filters and extra filter on grid with array and active dataprovider.
i have one issue how to take latest record if we are using groupby,groupby is picking up 1st record every times.
Filtering on ArrayDataProvider is basically very simple.
What you have to do is just make an array of items that match your filtering condition, and give it to the ArrayDataProvider as “allModels”. That’s all. Then the sorting and the paginating will be handled automatically by the data provider.
In real life, it may not be that easy to create "allModels" array that satisfy the filtering condition, especially when you want a good performance.
The issue regarding “groupby” is another thing. It’s not related directly to ArrayDataProvider.
Would you please elaborate your issue in detail?
[EDIT] Ok, I’ve found another topic of yours.