diff options
author | ctrlaltca@gmail.com <> | 2011-07-16 11:14:42 +0000 |
---|---|---|
committer | ctrlaltca@gmail.com <> | 2011-07-16 11:14:42 +0000 |
commit | 6b23858eea553ae0e33a7c26f35f4fb3204a37de (patch) | |
tree | 169d8d04bae345d825b0d9b8f8017c5b1b819bc7 | |
parent | fec18bb9251aa886f321b9697611c5c68ac52003 (diff) |
fix for #343 (reworked r2915 to be more backcompatible on clientside)
-rw-r--r-- | framework/Web/Javascripts/source/prado/controls/tabpanel.js | 40 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TTabPanel.php | 13 |
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 ab72f78d..a1ddca39 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;
}
|