2amigos / yii2-editable-widget

X-Editable Widget for Yii2
Other
58 stars 20 forks source link

Always one id #20

Closed anmaslov closed 9 years ago

anmaslov commented 9 years ago

When i try

<?foreach($model as $item):?>
 <?= Editable::widget( [
                'model' => $item,
                'attribute' => 'status',
                'url' => 'block/update',
                'type' => 'text',
                'mode' => 'pop',
                'id' => 'someid' . $item->id,
                'clientOptions' => [
                    'pk' => $item->id,
                ]
            ]);?>
<?endforeach?>

Generate all link with one id, is model-atribute, like this:

<a id="model-atribute">one</a>
<a id="model-atribute">two</a>
<a id="model-atribute">three</a>

need

<a id="someid1">one</a>
<a id="someid2">two</a>
anmaslov commented 9 years ago

Grrrr... found the answer my self. like this:

Editable::widget( [
                'model' => $item,
                'attribute' => 'status',
                'url' => 'block/update',
                'type' => 'text',
                'mode' => 'pop',
                'options' => ['id' => 'someid' . $item->id],
                'clientOptions' => [
                    'pk' => $item->id,
                ]
            ]);
tonydspaniard commented 9 years ago

Apologies... Quite busy ATM. Glad you solve it.