0

使用 Kartik Gridview,我在我的视图(Kartik Gridview)中有以下 ExpandRowColumn,其中我启用了使用 enableRowClick 选项单击和展开网格中的行(以显示相关的详细记录),并希望隐藏整个展开/折叠图标行并仅使用行点击功能。我尝试设置“禁用”选项,但这只会使 ExpandRowColumn 完全禁用。

[
  'class' => 'kartik\grid\ExpandRowColumn',
  'width' => '50px',
  'value' => function ($model, $key, $index, $column) {
       return GridView::ROW_COLLAPSED;
   },
   'detail' => function ($model, $key, $index, $column) {
       return Yii::$app->controller->renderPartial('_example', ['model' => $model]);
   },
   'headerOptions' => ['class' => 'kartik-sheet-style'],
   'expandOneOnly' => true,
   'enableRowClick' => true,
],
4

3 回答 3

1

我破解了小部件源,设法使图标消失,但列仍然存在。另外,当然它应该随着我更新小部件回来:-)!

在 \vendor\kartik-v\yii2-grid\ExpandRowColumn.php

public function init()
{
    parent::init();
    if (empty($this->detail) && empty($this->detailUrl)) {
        throw new InvalidConfigException("Either the 'detail' or 'detailUrl' must be entered");
    }
    $this->format = 'raw';
//    $this->expandIcon = $this->getIcon('expand');
//    $this->collapseIcon = $this->getIcon('collapse');
于 2017-04-24T13:22:04.963 回答
0
[
            'class' => 'kartik\grid\ExpandRowColumn',
            'width' => '50px',
            'value' => function ($model, $key, $index, $column) {
                return GridView::ROW_COLLAPSED;
            },
            'detail' => function ($model, $key, $index, $column) {
                return Yii::$app->controller->renderPartial('_expand', ['model' => $model]);
            },
            'headerOptions' => ['class' => 'kartik-sheet-style'],
            'expandOneOnly' => true,
            'expandIcon' => '<span class="glyphicon glyphicon-triangle-right"></span>',
            'collapseIcon' => '<span class="glyphicon glyphicon-triangle-bottom"></span>',
        ],
于 2019-04-09T14:39:12.303 回答
0

我也面临同样的问题。最后,我只是成功地放置了空字符串。我的解决方法如下

[
  'class' => 'kartik\grid\ExpandRowColumn',
  'width' => '50px',
  'value' => function ($model, $key, $index, $column) {
      return GridView::ROW_COLLAPSED;
   },
  'detail' => function ($model, $key, $index, $column) {
      return Yii::$app->controller->renderPartial('_expand', ['model' => $model]);
   },
  'headerOptions' => ['class' => 'kartik-sheet-style'],
  'expandOneOnly' => true,
  'expandIcon' => '',
  'collapseIcon' => '',
],
于 2019-05-14T08:54:11.813 回答