Hello,
I’m trying to return an array of valuers for a select field using the JEditable plugin. I’m having an issue pulling the array for the select field. I think my issue is that I can’t figure out the setup in Yii:
In my model
public function getProjectOptions()
{
$user=Users::model()->findByAttributes(array('username'=>Yii::app()->user->id));
$accountnumber = $user->accountnumber;
$projectsArray = CHtml::listData(Projects::model()->findAllByAttributes(array('accountnumber'=> $accountnumber)), 'internalid', 'projectname');
return $projectsArray;
}
In my controller (I setup the permission)
public function actionGetselects()
{
$selectTest=TimeEntries::model()->getProjectOptions();
$dataProvider=new CArrayDataProvider($selectTest);
$arraytest=$dataProvider->getData();
echo $arraytest;
}
In the JEditable plugin
Yii::app()->clientScript->registerScript("editable", "
$('.dle_select')editable('http://www.example.com/save.php', {
loadurl : 'http://localhost/yalla/index.php?r=timeentries/getselects',
type : 'select',
submit : 'OK'
});
", CClientScript::POS_READY);