First of all, I'm really disappointed after all googling and getting nothing!
I have an Arraydataprovider called
$data = [
400 => [
'name' => 'x',
'lesson_1' => '10',
'lesson_2' => '9',
...
],
389 => ...
]
It's generated in a for loop.
I want the values to be shown in a text box :
foreach($lessons as $lid => $name) {
$attrs[] = [
'attribute' => 'lesson_' . $lid,
'label' => $name['name'],
'format' => 'raw',
'value' => function($model, $key, $index) use($lid, &$data) {
return '<input class="txt" data-lid="'.$lid.'" type="text" value="'.$data[$key]['lesson_'.$lid].'"/>';
}
];
}
It gives me error : Undefined index: lesson_49 But I'm sure that $data provider, has the key lesson_49 (proved by var_dump);
what is the problem? :-(
var_dump($data)in your value function when!isset($data[$key]['lesson_'.$lid])?