kartik-v / yii2-grid

Enhanced GridView with various utilities for Yii Framework 2.0
http://demos.krajee.com/grid
Other
558 stars 302 forks source link

`filterAttribute` ignored in `DataColumn` when creating non-standard filters #1064

Closed BelegUS closed 1 year ago

BelegUS commented 1 year ago

Prerequisites

Steps to reproduce the issue

  1. Create some GridView
  2. Setup a column with non-standard filterType eg. GridView::FILTER_SELECT_2 and filterAttribute different than this column's attribute

Expected behavior and actual behavior

When I follow those steps, I see that filter input created (eg. input's name) is for attribute value

I was expecting filter input to have filterAttribute used for filter creation (eg. for input's name). That's what filterAttribute is for and it works for "standard" filter types (eg. regular dropdown).

Problem's most likely that attribute is passed instead of filterAttribute in DataColumn::renderFilterCellContent(): https://github.com/kartik-v/yii2-grid/blob/master/src/DataColumn.php#L266

Environment

Browsers

Operating System

Libraries

Isolating the problem