summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TTabPanel.php
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-05-21 18:14:36 +0000
committerctrlaltca@gmail.com <>2011-05-21 18:14:36 +0000
commit0892b27e326f14bd3f6229b55077ef5f9d5280b4 (patch)
tree24039ec47ba8977bf14ba435c058e758e901f185 /framework/Web/UI/WebControls/TTabPanel.php
parent6f00b28a1d9c7409c956a83866eac48a9493e83c (diff)
branch/3.1: merged bugfixes from trunk/ up to current
Diffstat (limited to 'framework/Web/UI/WebControls/TTabPanel.php')
-rw-r--r--framework/Web/UI/WebControls/TTabPanel.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TTabPanel.php b/framework/Web/UI/WebControls/TTabPanel.php
index 63710e56..e17008ba 100644
--- a/framework/Web/UI/WebControls/TTabPanel.php
+++ b/framework/Web/UI/WebControls/TTabPanel.php
@@ -412,7 +412,11 @@ class TTabPanel extends TWebControl implements IPostBackDataHandler
$cs->registerPradoScript('tabpanel');
$code="new $className($options);";
$cs->registerEndScript("prado:$id", $code);
- $cs->registerHiddenField($id.'_1',$this->getActiveViewIndex());
+ // ensure an item is always active and visible
+ $index = $this->getActiveViewIndex();
+ if(!$this->getViews()->itemAt($index)->Visible)
+ $index=0;
+ $cs->registerHiddenField($id.'_1', $index);
$page->registerRequiresPostData($this);
$page->registerRequiresPostData($id."_1");
}
@@ -435,13 +439,16 @@ class TTabPanel extends TWebControl implements IPostBackDataHandler
$options['ID']=$this->getClientID();
$options['ActiveCssClass']=$this->getActiveTabCssClass();
$options['NormalCssClass']=$this->getTabCssClass();
- $viewIDs=array();
+ $views='';
foreach($this->getViews() as $view)
{
- if($view->getVisible())
- $viewIDs[]=$view->getClientID();
+ if($views!='')
+ $views.=', ';
+ $views.= '"'.$view->getClientID().'":'.($view->getVisible() ? '1': '0' );
}
- $options['Views']='[\''.implode('\',\'',$viewIDs).'\']';
+
+ $options['Views']='{'.$views.='}';
+ $viewIDs=array();
return $options;
}