从 grid-view yii2 设置 href ="#" 或取消设置 html::a href

Set href ="#" or unset html::a href from grid-view yii2

我有以下代码:

 [   'format' => 'raw',
            'contentOptions'=>['style'=>'width: 5px;'],
            'value' => function($model) {
                if($model->id == Yii::$app->user->identity->id) {
                    return  Html::a('<i class="glyphicon glyphicon-share-alt"></i>',[''],['id'=> 'replay-to-'. $model->ID_KOMENTAR ]).' '. 
                            Html::a('<i class="glyphicon glyphicon-pencil"></i>', ['update', 'id' => $model->id]).' '.
                            Html::a('<i class="glyphicon glyphicon-trash"></i>', ['delete', 'id' => $model->id], ['data' => ['confirm' => 'Do you really want to delete this element?','method' => 'post']]);
                }
                return Html::a('<i class="glyphicon glyphicon-share-alt"></i>',['feedback', 'id' => $model->id],['id'=> 'replay-to-'. $model->ID_KOMENTAR ]);
            },
        ],

我希望重播按钮避免使我的页面重定向到另一个页面的 href,因为我想单击并将 jquery 放在那里。

我试过这个:

Html::a('<i class="glyphicon glyphicon-share-alt"></i>',[''],['id'=> 'replay-to-'. $model->ID_KOMENTAR ])

但它仍然重定向到另一个页面。

要将 href 值设置为 #:

Html::a('<i class="glyphicon glyphicon-share-alt"></i>', '#', ['id'=> 'replay-to-' . $model->ID_KOMENTAR]);

HTML 输出将是:

<a id="replay-to-1" href="#"><i class="glyphicon glyphicon-share-alt"></i></a>

要完全删除 href 属性,请使用 null(这是第二个参数的默认值):

Html::a('<i class="glyphicon glyphicon-share-alt"></i>', null, ['id'=> 'replay-to-' . $model->ID_KOMENTAR]);

HTML 输出将是:

<a id="replay-to-1"><i class="glyphicon glyphicon-share-alt"></i></a>

试试这个

Html::a('<i class="glyphicon glyphicon-share-alt"></i>', false, ['id'=> 'replay-to-'. $model->ID_KOMENTAR ]);