In my Gridview I have setup one of the Filters to be based on another filter (dependent select). This works.
[
'attribute'=>'ExpenseSubCategoryId',
'value'=>'expenseSubCategory.SubCategory',
'filter' => Html::activeDropDownList(
$searchModel,
'ExpenseSubCategoryId',
ArrayHelper::map(
LstExpensesSubCategories::find()
->where(["=", 'ExpenseCategoryId', $searchModel->ExpenseCategoryId])
->asArray()
->orderBy(['SubCategory'=>SORT_ASC])
->all(),
'ExpenseSubCategoryId',
'SubCategory'
),
[
'class'=>'form-control',
'prompt' => 'Select a Sub-Category',
]
),
],
but I’d like to be dependent only in the event a value is entered for $searchModel->ExpenseCategoryId, otherwise display all the options. Similar to s criteria of
=$searchModel->ExpenseCategoryId OR $searchModel->ExpenseCategoryId IS NULL
What would be the way to achieve this?