Answer the question
In order to leave comments, you need to log in
How to skip some rows in GridView (Yii2)?
The task is this: you need to display data in a tabular format through GridView. The difficulty is that some rows of the table must be skipped so that they do not exist at all. This must be done dynamically during output, the dataset (dataProvider) cannot be changed. How can this be done without unnecessary perversions?
Answer the question
In order to leave comments, you need to log in
In the standard implementation of GridView, there is no way to exclude rows, so either look for an extension that allows you to do this, or implement your own GridView descendant widget that will accept characteristics by which you need to exclude data and not display them by these characteristics. Of course, you can delete rows at the java-script level or hide them at the css level (using the rowOptions property), but these are real crutches.
Why can't the dataProvider be changed? What prevents to make 1 more dataProvider which to change? Stupidly clone and change what we want. You can make your own data provider inherited from ActiveDataProvider, which will have an additional method that will return a cropped version.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question