Hiya All.
I have been searching through the web for an answer for my issue, with very little success.
Here is what i am trying to do.
I have a Grid view at the top of the page showing a list of clients.
In the second half of the page i have TbTab widget.
What i would like to do, is click on any row in the table and the information from that row and other related information appears in the tab below.
Here is the code i have so far but it isn’t working
admin.php
<?php $this->widget('bootstrap.widgets.TbExtendedGridView', array(
'sortableRows'=>true,
'afterSortableUpdate' => 'js:function(id, position){ console.log("id: "+id+", position:"+position);}',
'selectableRows'=>1,
//'selectionChanged'=>'function(id){ location.href = "'.$this->createUrl('view').'/id/"+$.fn.yiiGridView.getSelection(id);}',
'type'=>'striped bordered',
'dataProvider' => $model->search(),
'columns' => array(
array(
'name'=>'View',
'type'=>'raw',
'value'=>'CHtml::ajaxLink("$data->id", "index.php/Accounts/ajaxupdate", array(
"data"=>array(
"id"=>$data->id,
),
"update"=>"#data",
));',
),
array(
'name'=>'id',
'header'=>'ID',
'type'=>'raw',
'value'=>'$data->id',
'htmlOptions'=>array('width'=>'40'),
),
'name',
'phone',
'mobile',
'type',
'account_manager',
'status',
array(
'class'=>'bootstrap.widgets.TbButtonColumn',
),
),
));
require_once 'bottom_tabs.php';
bottom_tabs.php
<?php
$this->widget('bootstrap.widgets.TbTabs', array(
'type'=>'tabs', // 'tabs' or 'pills'
'tabs'=>array(
//array('label'=>'Packages', 'content'=>'packages', 'active'=>true), //$this->renderPartial('_view', array('data'=>$model), true), 'active'=>true),
array('label' => 'Account Info', 'content' => $this->renderPartial('_view_acc_details', array('data'=>$model), true), 'active'=>true),
array('label' => 'Packages', 'items' => array(
array('label' => 'CLI', 'content' => 'Item1 Content'),
array('label' => 'Add-ons', 'content' => 'Item2 Content'),
array('label' => 'Carrier Status', 'content' => 'Item2 Content')
)),
array('label'=>'Wireless', 'content'=>'Profile Content'),
array('label'=>'Tickets', 'content'=>'Messages Content'),
array('label' => 'Activities', 'items' => array(
array('label' => 'Emails', 'content' => 'Item1 Content'),
array('label' => 'Calls', 'content' => 'Item2 Content'),
)),
array('label'=>'Leads', 'content'=>'Messages Content'),
array('label' => 'Invoices', 'items' => array(
array('label' => 'Invoices', 'content' => 'Item1 Content'),
array('label' => 'Pre-Invoices', 'content' => 'Item2 Content'),
)),
array('label' => 'Payments', 'items' => array(
array('label' => 'Pay Methods', 'content' => 'Item1 Content'),
array('label' => 'Payments', 'content' => 'Item2 Content'),
)),
array('label'=>'Returns', 'content'=>'Messages Content'),
array('label'=>'WiMAX', 'content'=>$this->renderPartial('_view_acc_wimax', array('data'=>$model), true)),
),
));
?>
_view_acc_details.php
<div id="data">
<b><?php echo CHtml::encode($data->getAttributeLabel('id')); ?>:</b>
<?php echo CHtml::encode($data->id); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('name')); ?>:</b>
<?php echo CHtml::encode($data->name); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('phone')); ?>:</b>
<?php echo CHtml::encode($data->phone); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('mobile')); ?>:</b>
<?php echo CHtml::encode($data->mobile); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('email')); ?>:</b>
<?php echo CHtml::encode($data->email); ?>
<br />
<br />
<br />
</div>
AjaxUpdate funstion
public function actionAjaxUpdate()
{
if(isset($_GET['id']))
{
$model = $this->loadModel($id);
$this->renderPartial('_view_acc_details', array('data'=>$model), false, true);
}
}
I am relatively new to YII and appreciate any help.
Many Regards
Liam