Yii – “Model.id” not defined for CArrayDataProvider and CSqlDataProvider - keyfield -


in controller want display users of application have used code:

    public function actionclientu($id)     { $model=$this->loadmodel($id); $appusers= $model->users;          $dataprovider=new carraydataprovider($appusers);         $this->render('clientu',array(             'dataprovider'=>$dataprovider,         ));      } 

but have error:

 "undefined appuser.id" 

it refer line:

$dataprovider=new cactivedataprovider('appuser', $appusers); 

any please ?

i solved problem ! here cause of problem: model keyfield isn't named id , haven’t defined column should used.

so have set keyfield this:

new carraydataprovider($users, array('keyfield' => 'user_id')); new csqldataprovider($users, array('keyfield' => 'user_id')); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -