[Bootstrap] Tbrelationalcolumn

Hello,

I want to create two nested tables by TbRelationalColumn. The first works properly, but when trying to access the second I close the first. If I access directly to the second Grid third proper operation.

It seems as don’t assigned the javascript to different classes.

[Controller]




	public function actionIndex()

	{

		$dataProvider=new CActiveDataProvider('Pedidos',array(

                        'criteria'=>array(

                                'order'=>'EstadoPedido_id ASC',

                        )

                ));

                $gallery = new Gallery();

                $gallery->name = true;

                $gallery->description = true;

                $gallery->versions = array(

                    'small' => array(

                        'resize' => array(200, null),

                    ),

                    'medium' => array(

                        'resize' => array(800, null),

                    )

                );

                

		$this->render('index',array(

			'dataProvider'=>$dataProvider,

                    'gallery'=>$gallery,

		),false,true);

	}


        public function actionPresupuestos($id)

        {

            $model=$this->loadModel($id);

            $c=new CDbCriteria;

            $c->condition='pp.Pedidos_id=<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/tongue.gif' class='bbc_emoticon' alt=':P' />_id';

            $c->params=array('<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/tongue.gif' class='bbc_emoticon' alt=':P' />_id'=>$model->id);

            $c->join='LEFT JOIN Pedidos_Presupuestos pp ON t.id=pp.Presupuestos_id';

            $dataProvider=new CActiveDataProvider('Presupuestos',array(

                    'criteria'=>$c,

            ));

            

            if (isset($_POST['Pedidos']))

            {

                $model->attributes=$_POST['Pedidos'];

                //$model->creacion=date("Y-m-d",strtime($model->creacion));

                //if ($model->save())

                    //$this->redirect(array('actualiza2','id'=>$model->id));

            }

            

            $this->renderPartial('presupuestos',array(

			'model'=>$model,

                        'dataProvider'=>$dataProvider,

		),false,true);

        }


        public function actionRelational($id)

        {

            $model=$this->loadModel($id);

            $c2=new CDbCriteria;

            $c2->condition='Presupuestos_id=<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/tongue.gif' class='bbc_emoticon' alt=':P' />_id';

            $c2->params=array('<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/tongue.gif' class='bbc_emoticon' alt=':P' />_id'=>$id);

            $c2->with=array('pedidosPiezas',array('condition'=>'id=:id','params'=>array(':id'=>'Pedidos_piezas_id')));

            $c2->together = true;

            

            //$c2->join="LEFT JOIN Pedidos_piezas AS pp ON pp.id=Pedidos_piezas_id";

            //$c2->select="pp.Inventario_idInventario as pieza, pp.Cantidad as cant, Cantidad, Precio";

            $dataProviderPiezas=new CActiveDataProvider('PresupuestosPiezas',array('criteria'=>$c2));

            

            $this->renderPartial('_relational',array(

                'id'=>$id,

                'model'=>$model,

                'dataProvider'=>$dataProviderPiezas,

            ),false,true);

        }



[views]

index.php




<?php

$this->layout='column1';


    $this->widget('bootstrap.widgets.TbButton',array(

        'label'=>'Añadir Presupuesto',

        'type'=>'primary',

        'size'=>'small',

        'url'=>$this->createUrl('presupuestos/crear',array('pedido'=>$model->id)),

    ));


    $this->widget('bootstrap.widgets.TbExtendedGridView',array(

        'id'=>'pedido-presupuestos-grid',

        'type'=>'striped bordered condensed',

        'dataProvider'=>$dataProvider,

        'template'=>"{items}",

        'columns'=>array(

            array(

                'class'=>'bootstrap.widgets.TbToggleColumn',

                'name'=>'aceptado',

                'header'=>'Aprobado'

            ),

            array(

                'class'=>'bootstrap.widgets.TbRelationalColumn',

                'name'=>'Proveedor',

                'cacheData'=>false,

                'type'=>'raw',

                'value'=>'Proveedores::model()->findByPk($data->Proveedores_idProveedores)->proveedor',

                'url'=>$this->createUrl('/presupuestos/relational',array('id'=>$dataProvider->id)),

                'cssClass'=>'showPiezasRelation',

                'afterAjaxUpdate' => 'js:function(tr,rowid,data){alert("row with id: "+rowid);}'

            ),

            array(

                'name'=>'Fecha',

                'class'=>'bootstrap.widgets.TbEditableColumn',

                'editable'=>array(

                    'type'=>'date',

                    //'url'=>$this->createUrl('/presupuestos/grabareditable'),

                    'viewformat'  => 'dd/mm/yyyy',

                    'placement'=>'right',

                ),

            ),

            array(

                'name'=>'NumOfer',

                'class'=>'bootstrap.widgets.TbEditableColumn',

                'editable'=>array(

                    'type'=>'text',

                ),

            ),

            array(

                'header'=>'Importe neto',

                'class'=>'ImportePresupuestoColumn',

            ),

            array(

                'htmlOptions' => array('nowrap'=>'nowrap'),

                'class'=>'bootstrap.widgets.TbButtonColumn',

                'viewButtonUrl'=>null,

                'updateButtonUrl'=>null,

                'deleteButtonUrl'=>null,

        )

        )

    ));

?>



presupuestos.php




<?php

$this->layout='column1';


    $this->widget('bootstrap.widgets.TbButton',array(

        'label'=>'Añadir Presupuesto',

        'type'=>'primary',

        'size'=>'small',

        'url'=>$this->createUrl('presupuestos/crear',array('pedido'=>$model->id)),

    ));


    $this->widget('bootstrap.widgets.TbExtendedGridView',array(

        'id'=>'pedido-presupuestos-grid',

        'type'=>'striped bordered condensed',

        'dataProvider'=>$dataProvider,

        'template'=>"{items}",

        'columns'=>array(

            array(

                'class'=>'bootstrap.widgets.TbToggleColumn',

                'name'=>'aceptado',

                'header'=>'Aprobado'

            ),

            array(

                'class'=>'bootstrap.widgets.TbRelationalColumn',

                'name'=>'Proveedor',

                'cacheData'=>false,

                'type'=>'raw',

                'value'=>'Proveedores::model()->findByPk($data->Proveedores_idProveedores)->proveedor',

                'url'=>$this->createUrl('/presupuestos/relational',array('id'=>$dataProvider->id)),

                'cssClass'=>'showPiezasRelation',

                'afterAjaxUpdate' => 'js:function(tr,rowid,data){alert("row with id: "+rowid);}'

            ),

            array(

                'name'=>'Fecha',

                'class'=>'bootstrap.widgets.TbEditableColumn',

                'editable'=>array(

                    'type'=>'date',

                    //'url'=>$this->createUrl('/presupuestos/grabareditable'),

                    'viewformat'  => 'dd/mm/yyyy',

                    'placement'=>'right',

                ),

            ),

            array(

                'name'=>'NumOfer',

                'class'=>'bootstrap.widgets.TbEditableColumn',

                'editable'=>array(

                    'type'=>'text',

                ),

            ),

            array(

                'header'=>'Importe neto',

                'class'=>'ImportePresupuestoColumn',

            ),

            array(

                'htmlOptions' => array('nowrap'=>'nowrap'),

                'class'=>'bootstrap.widgets.TbButtonColumn',

                'viewButtonUrl'=>null,

                'updateButtonUrl'=>null,

                'deleteButtonUrl'=>null,

        )

        )

    ));

?>



_relational.php




<?php

$this->widget('bootstrap.widgets.TbExtendedGridView',array(

    'id'=>'presupuestos-piezas-grid',

    'type'=>'striped bordered condensed',

    'dataProvider'=>$dataProvider,

    'template'=>"{items}",

    'columns'=>array(

        array(

            'name'=>'Pieza',

            'class'=>'bootstrap.widgets.TbEditableColumn',

            'value'=>'Inventario::model()->findByPk($data->pedidosPiezas->Inventario_idInventario)->pieza',

            'editable'=>array(

                'type'=>'text',

            )

        ),

        array(

            'name'=>'Cantidad',

            'class'=>'bootstrap.widgets.TbEditableColumn',

            'headerHtmlOptions' => array('style' => 'width:60px'),

            'editable'=>array(

                'type'=>'number',

                'url'=>$this->createUrl("presupuestos/grabareditable"),

                'placement'=>'left',

            ),

        ),

        array(

            'header'=>'€/u',

            'name'=>'Precio',

            'class'=>'bootstrap.widgets.TbEditableColumn',

            'value'=>'$data->Precio==null ? 0 : $data->Precio',

            'editable'=>array(

                'type'=>'number',

                'url'=>$this->createUrl('/presupuestos/grabareditable'),

                'placement'=>'left',

            ),

        ),

        array(

            'header'=>'€/línea',

            'value'=>'$data->Cantidad*$data->Precio',

        ),

        array(

            'htmlOptions' => array('nowrap'=>'nowrap'),

            'class'=>'bootstrap.widgets.TbButtonColumn',

            'viewButtonUrl'=>null,

            'updateButtonUrl'=>null,	

            'deleteButtonUrl'=>null,

        )

    )

));

?>



Nobody knows the problem?