如何实现Tab内的内容Ajax更新 [ 新手入门 ]
我想在一个页面内分多个tab,每个tab下的内容都是Ajax更新的,但是我按我的写法,最后Ajax会覆盖页面。 view:
$view_data = array(
'cluster_name' => $cluster_name,
'host_ip' => $host_ip,
'instance_ip' => $instance_ip,
'collect_status'=>$collect_status,
'comment' => $comment,
'Avg_Innodb_rows_read' => $Avg_Innodb_rows_read,
'Avg_Innodb_rows_inserted' => $Avg_Innodb_rows_inserted,
'Avg_Innodb_rows_updated' => $Avg_Innodb_rows_updated,
'Avg_Innodb_rows_deleted' => $Avg_Innodb_rows_deleted,
);
$this->widget('zii.widgets.jui.CJuiTabs', array(
'tabs'=>array(
'InnoSB Status' => $this->renderPartial('_innodb_status', $view_data, true),
'MySQL Processlist' => $this->renderPartial('_mysql_processlist', $view_data, true),
),
// additional javascript options for the tabs plugin
'options'=>array(
'collapsible'=>false,
),
));
$ajax = CHtml::ajax (
array(
'url'=>CController::createUrl('status/UpdateAjax'),
'update'=>'#status_monitor'
)
);
Yii::app()->clientScript->registerScript('update_div', "
function update_div() { $ajax }
setInterval(update_div, 2000);",
CClientScript::POS_READY);
controller:
public function actionUpdateAjax()
{
$this->loadInstanceStatus();
$data = array();
foreach ($_SESSION as $key=>$value) {
$data[$key] = $_SESSION[$key];
}
$data["collect_status"] = "采集运行中";
$data["comment"] = "系统运行良好";
$this->renderPartial('_innodb_status', $data, false, true);
#$this->renderPartial('_mysql_processlist', $data, false, true);
}
结果Ajax刷新时把tab都刷没了,就剩_innodb_status.php里面的内容了,不在tab内
共 0 条回复
没有找到数据。
P.Linux 江西
注册时间:2011-11-09
最后登录:1970-01-01
在线时长:0小时0分
最后登录:1970-01-01
在线时长:0小时0分
- 粉丝0
- 金钱25
- 威望0
- 积分25