yii2网格视图搜索、排序、过滤两个表
如何在yii2网格视图中搜索、排序、过滤两个表?从gii工具生成后,我得到了一个表列的搜索排序,但我必须对另一个表的列应用搜索、排序和筛选yii2网格视图搜索、排序、过滤两个表,yii2,Yii2,如何在yii2网格视图中搜索、排序、过滤两个表?从gii工具生成后,我得到了一个表列的搜索排序,但我必须对另一个表的列应用搜索、排序和筛选 <?= GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ ['class' => 'yii\grid\Seri
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'username',
// 'account_activation_token',
'email:email',
'profile.name',
[
'attribute' => 'name',
'value' => 'profile.name',
'enableSorting' => true,
//here i want to use the filter option just like in yii 1.1 but i dont know how to use the textbox search in yii2.0
],
// 'usertype',
// 'status',
// 'created_at',
// 'updated_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
尝试使用:
[
'attribute' => 'name',
'value' => 'profile.name',
'enableSorting' => true,
'filter' => function($model){
return Html::activeTextInput($searchModel, $this->name),
}
],
您想使用另一个表中相关记录的数据吗?请先用谷歌搜索一下。下面是链接:@JoeMiller是的,我正在使用另一个表中的数据,需要对它们应用文本框搜索,我已经用谷歌搜索过了,但没有两个表记录的例子。@chinmay我在这里用过很多谷歌搜索和使用过['attribute'=>'name','value'=>'profile.name','enablesording'=>true,],这段代码,但我不是geet文本框,所以您可以显示代码您到目前为止尝试了什么吗?您正面临问题的确切位置。