YII GridViewアプリケーション

6055 ワード

 = GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'goods_name',
            [
                'attribute' => 'market_price',
                'filter' => ' :'.Html::activeTextInput($searchModel, 'market_price_low', ['class' => 'form-control'])." :".Html::activeTextInput($searchModel, "market_price_height", ['class' => 'form-control']),
            ],
            [
                'attribute' => 'shop_price',
                'filter' => " :".Html::activeInput("text", $searchModel, "shop_price_low" , ['class' => 'form-control'])." :".Html::activeInput("text", $searchModel, "shop_price_height",['class' => 'form-control']),
            ],
             [
                 'attribute' => 'is_on_sale',
                 'filter' => [" " => " ", " " => " "],
                 'headerOptions' => ['width' => 80],
             ],
             [
                 'attribute' =>'is_delete',
                 'filter' => [" " => " ", " " => " "],
                 'headerOptions' => ["width" => 105],
             ],

             [
                 'attribute' => 'addtime',
                 'format' => 'datetime',
                 'filter' => ' :'.Html::activeInput('date', $searchModel, "time_start", ['class' => 'form-control'])." :".Html::activeInput("date", $searchModel, "time_end", ['class' => 'form-control'])
             ],

            [
                "attribute" => 'logo',
                "label" => " ",
                "format" => [
                    "image",
                    [
                        "width"=>"100",
                        "height"=>"40"
                    ]
                ],
                "value" => function ($model) {
                    return \YII::$app->params['image_root_path'].$model->logo;
            }],

            ['class' => 'yii\grid\ActionColumn', 'header' => ' '],