widget - Display data from related table & concatenate with column Yii2 SortableInput -


i'm using kartik's sortableinput widget in basic yii2 app, i've been able generate list table in db, items displayed show id of rows in tablea. want show specific column tablea , column tableb related tablea (the relation , join exists in modelsearch). have in form:

<?php     $items = [];     $dosis = dosis::find()         ->all();     foreach ($dosis $key) {         $items[$key->id_dosis] = [             'content' => $key->id_dosis,             'options' => ['data' => ['id_dosis'=>$key->id_dosis]],         ];     } ?>  <?= $form->field($model, 'dosis')->widget(sortableinput::classname(), [         'items' => $items,     'hideinput' => false,     'options' => ['class'=>'form-control', 'readonly'=>true]     ]); ?> 

use $key->relationname->fieldname:

foreach ($dosis $key) {     $items[$key->id_dosis] = [         'content' => $key->relationname->fieldname,         'options' => ['data' => ['id_dosis'=>$key->relationname->fieldname]],     ]; } 

Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -