summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/Javascripts/source/prado/controls/tabpanel.js40
-rw-r--r--framework/Web/UI/WebControls/TTabPanel.php13
2 files changed, 26 insertions, 27 deletions
diff --git a/framework/Web/Javascripts/source/prado/controls/tabpanel.js b/framework/Web/Javascripts/source/prado/controls/tabpanel.js
index 363b5271..f613a677 100644
--- a/framework/Web/Javascripts/source/prado/controls/tabpanel.js
+++ b/framework/Web/Javascripts/source/prado/controls/tabpanel.js
@@ -11,54 +11,54 @@ Prado.WebUI.TTabPanel.prototype =
onInit : function(options)
{
this.views = options.Views;
+ this.viewsvis = options.ViewsVis;
this.hiddenField = $(options.ID+'_1');
this.activeCssClass = options.ActiveCssClass;
this.normalCssClass = options.NormalCssClass;
- var i = 0;
- for(var index in options.Views)
+ var length = options.Views.length;
+ for(var i = 0; i<length; i++)
{
- var element = $(index+'_0');
- if (options.Views[index])
+ var item = options.Views[i];
+ var element = $(item+'_0');
+ if (options.ViewsVis[i])
{
- Event.observe(element, "click", this.elementClicked.bindEvent(this,index));
+ Event.observe(element, "click", this.elementClicked.bindEvent(this,item));
}
+
if(element)
{
if(this.hiddenField.value == i)
{
element.className=this.activeCssClass;
- $(index).show();
- }
- else
- {
+ $(options.Views[i]).show();
+ } else {
element.className=this.normalCssClass;
- $(index).hide();
+ $(options.Views[i]).hide();
}
}
- i++;
}
},
elementClicked : function(event,viewID)
{
- var i = 0;
- for(var index in this.views)
+ var length = this.views.length;
+ for(var i = 0; i<length; i++)
{
- if ($(index))
+ var item = this.views[i];
+ if ($(item))
{
- if(index == viewID)
+ if(item == viewID)
{
- $(index+'_0').className=this.activeCssClass;
- $(index).show();
+ $(item+'_0').className=this.activeCssClass;
+ $(item).show();
this.hiddenField.value=i;
}
else
{
- $(index+'_0').className=this.normalCssClass;
- $(index).hide();
+ $(item+'_0').className=this.normalCssClass;
+ $(item).hide();
}
}
- i++;
}
}
};
diff --git a/framework/Web/UI/WebControls/TTabPanel.php b/framework/Web/UI/WebControls/TTabPanel.php
index e17008ba..c762c11e 100644
--- a/framework/Web/UI/WebControls/TTabPanel.php
+++ b/framework/Web/UI/WebControls/TTabPanel.php
@@ -439,16 +439,15 @@ class TTabPanel extends TWebControl implements IPostBackDataHandler
$options['ID']=$this->getClientID();
$options['ActiveCssClass']=$this->getActiveTabCssClass();
$options['NormalCssClass']=$this->getTabCssClass();
- $views='';
+ $viewIDs=array();
+ $viewVis=array();
foreach($this->getViews() as $view)
{
- if($views!='')
- $views.=', ';
- $views.= '"'.$view->getClientID().'":'.($view->getVisible() ? '1': '0' );
+ $viewIDs[]=$view->getClientID();
+ $viewVis[]=$view->getVisible();
}
-
- $options['Views']='{'.$views.='}';
- $viewIDs=array();
+ $options['Views']='[\''.implode('\',\'',$viewIDs).'\']';
+ $options['ViewsVis']='[\''.implode('\',\'',$viewVis).'\']';
return $options;
}