Hello out there,
I am able to populate a pulldown menu inside a TBGrid with values depending on the current record inside the Grid (= same row). If I do this without editable fields it works fine and as expected.
BUT:
My next step would be to populate the Pulldown as a editable field, so that the changes in the drop down are saved.
So for example I have a column called Cities and I want to show in the pulldown only the streets of that city.
For this I would normally use the "$data->id" helper as that would allow me to pass this value back to the controller for making the query.
But this is not working within the TbEditableColumn. The error is that it does not know the variable $data.
Does anybody have an idea how to solve this?
Right now I have the code below.
My goal would be to pass in the $model->availableStreets($data->id) the id of the current row (=city) to the availbelStreets function to get as a return the streets back.
I do know what I have to do inside my MODEL to get the query and return the streets.
My problem only lies in how to get the ID of the current row from the grid.
array(
'class' => 'bootstrap.widgets.TbEditableColumn',
'name' => 'streets',
'htmlOptions'=>array('width'=>'150'),
'editable' => array(
'type' => 'select',
'source' => CHtml::listData($model->availableStreets($data->id), 'id', 'street'),
'url' => $this->createUrl('cities/editable'),
'placement' => 'right',
)
),
Thanks for any hints that could point me into the right direction…
gb5256