hi
i have another problem, jeje
the extension acselect not work for me
does nothing when press "Change Rol"
the code…
in the controler
<?php
class UsuarioRolesController extends CController
{
..........
public function actions()
{
return array(
'pro.'=>'application.extensions.acselect.ACSelect',
);
}
..........
in the view
<div class="simple">
<?php
echo CHtml::activeLabel($model,'rol_id_rol');
/*
* which fields should be displayed in the info part
* label => columns of model to display
*/
$info_fields=array(
'NombreRol'=>array('nombre'),
);
/*
* glue for multiple columns if no glue value is given <br /> is used
*/
$info_glues=array(
'NombreRol'=>' ',
);
/* js list pattern for the drop down list */
$list_pattern="'<small>'+i + '/' + max + ':</small> <b>' + row.nombre + '</b><br />'";
/*
* set colModel (columns to select for display and return)
* tablecolumn => options
* 0 - display name ( not used yet maybe for generated js info pattern etc.
* 1 - datafield
* 2 - searchpattern eg. name: country:
* 3 - searchable (2 -> yes and default, 1 -> yes, 0 -> no.)
*/
$colModel=array();
//$colModel['ID'] = array('ID','id','id',1); // searchable
$colModel['NombreRol'] = array('NombreRol','nombre','nombre',2); // searchable and default
//$colModel['FirstName'] = array('FirstName','firstname','firstname',1); // searchable
//$colModel['EMail'] = array('EMail','email','email',1); // searchable
//$colModel['Country'] = array('Country','country','country',1); // searchable
$ac_select_options=array(
'model' =>$model, // your model object of the admin form
'select_model'=> Roles::model(), // model class of the selection
'attribute' => "rol_id_rol", // which attribute
'actionPrefix'=>'pro.', // has to be the same as in the controller
'name'=>'nombre', // name
'colmodel'=>$colModel,
'buttonLabel'=>'Rol', // label of the change button 'change ...'
'default_search_data_field'=>'nombre', // default data field for setting in the search field
'default_data_field'=>'id_rol', // default data field for setting the value of the hidden field on selection
'info_fields'=>$info_fields,
'info_glues'=>$info_glues,
'list_pattern'=>$list_pattern,
);
$ACSelectobj=$this->createWidget('application.extensions.acselect.ACSelect',$ac_select_options);
$ACSelectobj->run();
?>
</div>
model
UsuarioRoles
-
id_usuario_rol
-
rol_id_rol
-
usu_id_usuario
Roles
-
id_rol
-
nombre
.......
public function relations()
{
return array(
'usuario' => array(self::BELONGS_TO, 'Usuarios', 'usu_id_usuario'),
'rol' => array(self::BELONGS_TO, 'Roles', 'rol_id_rol'),
);
}
.........
thanks