From 0fb75d64f8dbcc98b4c06e7556125b94bf612819 Mon Sep 17 00:00:00 2001 From: Jens Klaer Date: Wed, 20 May 2015 15:54:33 +0200 Subject: made TJuiControl options changeable during callback - TJuiControlOptions are now stored in viewstate and tracked by the new TJuiCallbackPageStateTracker class extending the default viewstate tracker class - TJuiCallbackPageStateTracker registers endscripts automatically for each changed option for the clientside changes, added some normalized getter for that --- framework/Web/UI/JuiControls/TJuiResizable.php | 27 ++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'framework/Web/UI/JuiControls/TJuiResizable.php') diff --git a/framework/Web/UI/JuiControls/TJuiResizable.php b/framework/Web/UI/JuiControls/TJuiResizable.php index 5e1f8d31..ef0cb059 100644 --- a/framework/Web/UI/JuiControls/TJuiResizable.php +++ b/framework/Web/UI/JuiControls/TJuiResizable.php @@ -52,15 +52,34 @@ class TJuiResizable extends TActivePanel implements IJuiOptions, ICallbackEventH $this->setAdapter(new TJuiControlAdapter($this)); } + /** + * @return string the name of the jQueryUI widget method + */ + public function getWidget() + { + return 'resizable'; + } + + /** + * @return string the clientid of the jQueryUI widget element + */ + public function getWidgetID() + { + return $this->getClientID(); + } + /** * Object containing defined javascript options * @return TJuiControlOptions */ public function getOptions() { - if($this->_options===null) - $this->_options=new TJuiControlOptions($this); - return $this->_options; + if (($options=$this->getViewState('JuiOptions'))===null) + { + $options=new TJuiControlOptions($this); + $this->setViewState('JuiOptions', $options); + } + return $options; } /** @@ -101,7 +120,7 @@ class TJuiResizable extends TActivePanel implements IJuiOptions, ICallbackEventH $writer->addAttribute('id',$this->getClientID()); $options=TJavascript::encode($this->getPostBackOptions()); $cs=$this->getPage()->getClientScript(); - $code="jQuery('#".$this->getClientId()."').resizable(".$options.");"; + $code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); } -- cgit v1.2.3