如何添加搜索栏?

问题描述 投票:0回答:1

我设法合并了两列。但搜索栏不见了。如何添加搜索栏? 这是代码:

echo GridView::widget([
                        'dataProvider' => $dataProviderAcad,
                        'filterModel' => $searchModelAcad,
                        'columns' => [
                            'prog_and_remark_combined' => [
                                'format' => 'raw',
                                'label' => "Programme Name",
                                'value' => function ($data) {
                                    return nl2br(
                                        $data->NAME_PROG_ENG .
                                        "\r\nPreviously known as: " .
                                        $data->REMARKS
                                    );
                                }
                            ],
php search yii2
1个回答
0
投票

在 AcadSearch 类中为 prog_and_remark_combined 添加一个公共变量

    class YourModelAcadSearch extends YourModelAcad
    {

        public $prog_and_remark_combined;

        /**
         * @inheritdoc
         */
        public function rules()
        {
            return [
            ....
© www.soinside.com 2019 - 2024. All rights reserved.