I have a table like this with 5 columns.
TableName
-Column1
-Column2
-Column3
-Column4
-Column5
I had merged them to display them in grid view as single column.
Question How can i make filter condition query to search them based on user input.? Eg.User types something as input, it have search from all the 5 columns and return the result based on the search input.(Sorting works fine, please help me with filtering)
If someone could helpme it would be great, Thanks.
UPDATE:
$query->andFilterWhere(['ilike', '"x"."y"', $this->variantName]) ->andFilterWhere(['"a"."b"' => $this->ClassId])
->andFilterWhere(['"c"."d"' => $this->FamilyId])
->andFilterWhere(['"e"."f"' => $this->PlatformId])
->andFilterWhere(['ilike', '"g"."h"', $this->subFamilyName])
This is how my old model looks like the fields with familyId,classId,PlatformId are integer and subfamilyname,variantname are text.
Modified:
$query->andFilterWhere(['or',
['ilike', '"x"."y"', $this->Combo],
['"a"."b"' => $this->Combo],
['"c"."d"' => $this->Combo],
['"e"."f"' => $this->Combo],
['ilike', '"g"."h"', $this->Combo],
])
UPDATE 2: This is how the query looked before merging columns.
->andFilterWhere(['ilike', '"storeNames"."variantName"', $this->variantName])
->andFilterWhere(['"storeNames"."classId"' => $this->malwareClassId])
->andFilterWhere(['"storeNames"."familyId"' => $this->malwareFamilyId])
->andFilterWhere(['"storeNames"."platformId"' => $this->malwarePlatformId])
->andFilterWhere(['ilike', '"storeNames"."subFamilyName"', $this->subFamilyName]);