<?= \yii\grid\GridView::widget([
'dataProvider' => new \yii\data\ArrayDataProvider([
'allModels' => [],
]),
'showHeader' => false,
'emptyText' => false,
]) ?>
<table><tbody></tbody></table>
<table><tbody><tr><td colspan="0"><div class="empty"></div></td></tr></tbody></table>
| Q | A
| ---------------- | ---
| Yii version | 2.0.10
| PHP version |5.6
| Operating system |xubuntu 16.04
Is it solve your problem?
<?= \yii\grid\GridView::widget([
'dataProvider' => new \yii\data\ArrayDataProvider([
'allModels' => [],
]),
'showOnEmpty' => false,
'emptyText' => '<table><tbody></tbody></table>',
]) ?>
I got <div class="empty"><table><tbody></tbody></table></div>
And the GridView::$layout has not been used for rendering.
Thank you for the idea, but the solution is more like a crutch.
How would you solve it?
In this place I would like to add something like
if ($this->emptyText === false)
return "<tbody>\n</tbody>";
or add an additional condition here if (empty($rows) && $this->emptyText !== false) {
Additional condition solution sounds good to me.
@dkhlystov would you like to submit a PR?
What do you mean? What is PR?
PR is a pull request.
We have a Git workflow for Yii 2 contributors, that will help you to do it for the first time
This is to complicated for me.
Then either core team or community will handle it later. Thanks for idea.