Thx bettor.
Here:
<?php
$form = $this->beginWidget('CActiveForm', array(
'id' => 'form',
'enableAjaxValidation' => false,
'htmlOptions' => array('enctype' => 'multipart/form-data'),
));
?>
<?php
$this->widget('application.widgets.SearchField', array('model' => $model,
'id' => 'ptUsuarios',
'attribute' => 'parusua_id',
'class' => 'Usuario',
'labelField' => 'desc_login',
'title' => 'Usuários',
'columns' => array('desc_login'),
'gridToUpdate' => 'gridUsuarioEmpresa',
'fieldToFilter' => 'UsuarioEmpresa[parusua_id]',
));
?>
<?php $this->endWidget(); ?>
<?php echo $this->renderPartial('_gridEmpresaUsuario', array('model' => $model)); ?>
_gridEmpresaUsuario:
<?php
$this->widget('application.widgets.GridView', array(
'id' => 'gridUsuarioEmpresa',
'dataProvider' => $model->search(),
'filter' => $model,
'navegacao' => false,
'columns' => array(
array('name' => 'parempr_id',
'value' => '$data->parempr->parentd->desc_razao_social',
),
array(
'name' => 'indr_padrao',
'htmlOptions' => array(
'style' => 'text-align: center',
),
'headerHtmlOptions' => array(
'style' => 'text-align: center',
),
'filter' => array('S' => 'SIM',
'N' => 'NÃO',
),
),
array('class' => 'CButtonColumn',
'template' => '{update}{delete}',
'buttons' => array(
'update' => array(
'label' => 'Editar',
'imageUrl' => Yii::app()->baseUrl . '/images/grid/ico_editar.png',
'url' => 'Yii::app()->getController()->createUrl("editar", array("id" =>$data["id"]))',
),
'delete' => array(
'label' => 'Apagar Produto',
'imageUrl' => Yii::app()->baseUrl . '/images/grid/ico_excluir.png',
'url' => 'Yii::app()->getController()->createUrl("deletar", array("id" =>$data["id"]))',
'click' => 'function(){if(confirm("Deseja Realmente Excluir este Registro ?"))return true; else return false;}',
),
))
),
));
?>
my GridView:
http://pastebin.com/0mqppx27
So, my SearchField theres a grid in, when we select a row, they
ll filter the gridUsuarioEmpresa grid!!
take a look:
searchfield clicked:
grid filtered:
bug:
when i click in searchfield`s grid, i call this one:
$.fn.updateSecondGrid = function (pId, pGridId, pLabelField) {
if(pId.length >= 1 && pGridId.length >= 1 && pLabelField.length >= 1) {
var vData = pLabelField + "=" + pId;
jQuery.fn.yiiGridView.update(pGridId, {data: vData});
};
}