yii2 GridView标题链接删除

时间:2018-01-11 10:24:56

标签: php gridview yii2 dataprovider

在yii2 gridview中,我有这段代码:

echo GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn',
                'options' => [
                        'width' => '40',
                    'label' => false,
                    'format' => 'raw',
                ],

            ],

            'title',

            [
                'class' => 'yii\grid\ActionColumn',
                'contentOptions' => [],
                'header'=>'',
                'template' => '{link}',
                'buttons' => [
                    'link' => function ($url,$model,$key) use($url) {
                        return Html::a(Yii::t('app','app.Application job'), $url->url.'?application='.$model->id, ['class' => 'btn btn-application-button']);
                    },
                ],
                'options' => ['width' => '60'],
            ],
        ],
    ]);
表格标题中的

在网格视图中,正在生成带有一些URL地址的文本....

/职业/索引FIRST_STEP = PAGETITLE-60安培;排序=标题

网址已损坏且不必要,但我该如何删除它?而且只是文字?

这是表格中的代码:

<table class="table table-striped table-bordered">
  <colgroup>
    <col width="40" format="raw">
      <col width="60"></colgroup>
        <thead>
            <tr>
              <th>#</th>
              <th><a href="/bg/career/index?first_step=%D0%BA%D0%B0%D1%80%D0%B8%D0%B5%D1%80%D0%B8-60&amp;sort=title" data-sort="title">Позиция</a></th>
              <th class="action-column">&nbsp;</th>
            </tr>
         </thead>

.... //这是我想成为原始格式文本的链接

1 个答案:

答案 0 :(得分:2)

尝试将sort = false分配给dataProvider ..例如:

 $dataProvider['sort'=>false];

这应该禁用使用不需要的URL

调用的排序和排序