You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding ngRestFilters on a list as a result of ngRestRelations, the filter will show all rows regardless of the relationship
for example
1- in the news module, from the categories list if you select "Articles" list through the relationship for "Category 01"
2- Then from the list of news for "Category 01" if you filter on is_online using ngRestFilters, it will show all news for all categories
ngRestRelations code public function ngRestRelations() { return [ ['label' => 'Articles', 'targetModel' => Article::class, 'dataProvider' => $this->getArticles()], ]; }
public function getArticles() { return $this->hasMany(Article::class, ['cat_id' => 'id']); }
ngRestFilters code
public function ngRestFilters() { return [ 'Online' => self::ngRestFind()->andWhere(['=', 'is_online', 1]), 'Offline' => self::ngRestFind()->andWhere(['=', 'is_online', 0]), ]; }
Image 1:
News list
Image 2:
Categories list
Image 3:
News for Category 2 using ngRestRelations
Image 4: (The issue)
News for Category 2 using ngRestRelations after using ngRestFilters
The text was updated successfully, but these errors were encountered:
Yes, i have to admit, this is true. In ngrest relation context, the filter won't have those context informations, as those "raw" data providers will be returned:
When adding ngRestFilters on a list as a result of ngRestRelations, the filter will show all rows regardless of the relationship
for example
1- in the news module, from the categories list if you select "Articles" list through the relationship for "Category
01"
2- Then from the list of news for "Category 01" if you filter on is_online using ngRestFilters, it will show all news for all categories
ngRestRelations code
public function ngRestRelations() { return [ ['label' => 'Articles', 'targetModel' => Article::class, 'dataProvider' => $this->getArticles()], ]; }
public function getArticles() { return $this->hasMany(Article::class, ['cat_id' => 'id']); }
ngRestFilters code
public function ngRestFilters() { return [ 'Online' => self::ngRestFind()->andWhere(['=', 'is_online', 1]), 'Offline' => self::ngRestFind()->andWhere(['=', 'is_online', 0]), ]; }
Image 1:

News list
Image 2:

Categories list
Image 3:

News for Category 2 using ngRestRelations
Image 4: (The issue)
News for Category 2 using ngRestRelations after using ngRestFilters
The text was updated successfully, but these errors were encountered: