Skip to content

Commit

Permalink
fix problem not unique tab id if ajax expand mootensai#139
Browse files Browse the repository at this point in the history
  • Loading branch information
drew1two committed Mar 8, 2020
1 parent 0bdd25f commit 16ecab8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crud/default/views/_expand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

use yii\helpers\Inflector;
use yii\helpers\StringHelper;

$pk = empty($generator->tableSchema->primaryKey) ? $generator->tableSchema->getColumnNames()[0] : $generator->tableSchema->primaryKey[0];
?>
<?= "<?php" ?>

Expand All @@ -14,6 +16,7 @@
$items = [
[
'label' => '<i class="glyphicon glyphicon-book"></i> '. Html::encode(<?= $generator->generateString(StringHelper::basename($generator->modelClass)) ?>),
'options' => ['id' => "tab_<?= StringHelper::basename($generator->modelClass) ?>_{$model-><?= $pk ?>}"],
'content' => $this->render('_detail', [
'model' => $model,
]),
Expand All @@ -22,6 +25,7 @@
<?php if ($rel[2] && isset($rel[3]) && !in_array($name, $generator->skippedRelations)): ?>
[
'label' => '<i class="glyphicon glyphicon-book"></i> '. Html::encode(<?= $generator->generateString(Inflector::camel2words($rel[1])) ?>),
'options' => ['id' => "tab_<?= $rel[1] ?>_{$model-><?= $pk ?>}"],
'content' => $this->render('_data<?= $rel[1] ?>', [
'model' => $model,
'row' => $model-><?= $name ?>,
Expand All @@ -30,6 +34,7 @@
<?php elseif(isset($rel[$generator::REL_IS_MASTER]) && !$rel[$generator::REL_IS_MASTER]): ?>
[
'label' => '<i class="glyphicon glyphicon-book"></i> '. Html::encode(<?= $generator->generateString(Inflector::camel2words($rel[1])) ?>),
'options' => ['id' => "tab_<?= $rel[1] ?>_{$model-><?= $pk ?>}"],
'content' => $this->render('_data<?= $rel[1] ?>', [
'model' => $model-><?= $name ?>
]),
Expand Down

0 comments on commit 16ecab8

Please sign in to comment.