Php 取消选择一个Select2::widget的值时,它会从所有列中删除过滤器
在取消选择地区名称时,状态名称值也将取消选择如何防止此情况 在网格视图中选择2::widget作为州名称和地区名称 取消选择一个Select2::widget的值时,它会从所有列中删除过滤器 请提供解决方案Php 取消选择一个Select2::widget的值时,它会从所有列中删除过滤器,php,yii2,Php,Yii2,在取消选择地区名称时,状态名称值也将取消选择如何防止此情况 在网格视图中选择2::widget作为州名称和地区名称 取消选择一个Select2::widget的值时,它会从所有列中删除过滤器 请提供解决方案 <?php Pjax::begin(); ?> <?= GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'co
<?php Pjax::begin(); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn','header'=>'S.No.','headerOptions' => [
'style' => 'color:#3c8dbc'],],
[
'attribute' => 'state_id',
'filter' => Select2::widget([
'name' => 'DistrictSearch[state_id]',
'value' => isset($_GET['DistrictSearch']['state_id']) ? $_GET['DistrictSearch']['state_id'] :"",
'data' => dependentFilterDropdown('state',$_GET),
'options' => ['placeholder' => 'Select All','multiple' => true,'onchange' => 'refreshFilter(this.value)'],
'pluginOptions' => [
'allowClear' => true
],
]),
'value' => 'state.state_name'
],
[
'attribute' => 'district_name',
'filter' => Select2::widget([
'name' => 'DistrictSearch[district_name]',
'value' => isset($_GET['DistrictSearch']['district_name']) ? $_GET['DistrictSearch']['district_name'] :"",
'data' => dependentFilterDropdown('district',$_GET),
'options' => ['placeholder' => 'Select All','multiple' => true,'onchange' => 'refreshFilter(this.value,"d")'],
'pluginOptions' => [
'allowClear' => true
],
]),
'value' => 'district_name'
],
Utilities::Phase(),
Utilities::CreatedAt('index'),
Utilities::UpdatedAt('index'),
],
]); ?>
你为什么要加一次?这两个领域共同依赖吗?或者它们是完全独立的?这两个领域共同依赖。我应该用什么来代替onchange?
This function is call after unselect the filter value.
function refreshFilter(value,type){
if (value == "") {
window.location.replace("create");process.exit();
}
}