in my GridView, when I click in a ButtonColumn,I make a URL, but, I want to make the URL with parameters del modelo ($data->attribute1 and $data->attribute2) AND with external variable, for example $cont.
‘url’=>‘Yii::app()->createUrl(“nivelesmenu/crear”, array(“at1”=>$data->attribute1, “at2”=>$data->attribute2, “exter”=>$cont))’, //[color="#00FF00"]<-How to do this?[/color]
public function actionIndex($_mod)
{
$model=new Maestrante('search');
{...some code you need here...}
$model->str_modalidad = $_mod;
$this->render('index',array(
'model'=>$model,
));
}
…
call the variable in the grid, in this example I made a Button "Ficha" and I call $model->str_modalidad
class Nivelesmenu extends CActiveRecord
{
public $id_usr;
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'nivelesmenu';
}
......
and When I try to set whit a value in my action, I have an Error: "Property "Nivelacceso.id_usr" is not defined."
in the action , only do:
$nivelacceso = new Nivelacceso('search');
$nivelacceso->id_usr=1;
Can you help me please?
Thanks very much.
Saludos desde Argentina y perdon por mi ingles, estoy apreniendo. Muchisimas Gracias
Hi man, hey do not worry about your English I’m from Cuba and I’m doing my best just like you. That’s not a problem in this forum is just that we need to use this language so most user understand us. Listen there’s a problem about the code; you define the variable in the model Nivelesmenu and call it from Nivelacceso. Of course is not define. Here post you the code: