summaryrefslogtreecommitdiff
path: root/framework/Web/UI/JuiControls/TJuiSortable.php
diff options
context:
space:
mode:
authorJens Klaer <kj.landwehr.software@gmail.com>2015-05-20 15:54:33 +0200
committerJens Klaer <kj.landwehr.software@gmail.com>2015-05-20 15:54:33 +0200
commit0fb75d64f8dbcc98b4c06e7556125b94bf612819 (patch)
tree248dcab8fc248ab0b0d521e093c9da3b90ab560a /framework/Web/UI/JuiControls/TJuiSortable.php
parentee25e9fc2a4cc702f1ac9af5645134eaa893cf4c (diff)
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
Diffstat (limited to 'framework/Web/UI/JuiControls/TJuiSortable.php')
-rw-r--r--framework/Web/UI/JuiControls/TJuiSortable.php29
1 files changed, 24 insertions, 5 deletions
diff --git a/framework/Web/UI/JuiControls/TJuiSortable.php b/framework/Web/UI/JuiControls/TJuiSortable.php
index 2fdf80dc..1ea5b6d0 100644
--- a/framework/Web/UI/JuiControls/TJuiSortable.php
+++ b/framework/Web/UI/JuiControls/TJuiSortable.php
@@ -50,14 +50,33 @@ class TJuiSortable extends TActivePanel implements IJuiOptions, ICallbackEventHa
}
/**
+ * @return string the name of the jQueryUI widget method
+ */
+ public function getWidget()
+ {
+ return 'sortable';
+ }
+
+ /**
+ * @return string the clientid of the jQueryUI widget element
+ */
+ public function getWidgetID()
+ {
+ return $this->getClientID() . '_0';
+ }
+
+ /**
* 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;
}
/**
@@ -103,7 +122,7 @@ class TJuiSortable extends TActivePanel implements IJuiOptions, ICallbackEventHa
$writer->addAttribute('id',$this->getClientID());
$options=TJavascript::encode($this->getPostBackOptions());
$cs=$this->getPage()->getClientScript();
- $code="jQuery('#".$this->getClientId()."_0').sortable(".$options.");";
+ $code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");";
$cs->registerEndScript(sprintf('%08X', crc32($code)), $code);
}
@@ -274,7 +293,7 @@ class TJuiSortable extends TActivePanel implements IJuiOptions, ICallbackEventHa
protected function createRepeater()
{
$repeater = Prado::createComponent('System.Web.UI.WebControls.TRepeater');
- $repeater->setHeaderTemplate(new TJuiSortableTemplate('<ul id="'.$this->getClientId().'_0'.'">'));
+ $repeater->setHeaderTemplate(new TJuiSortableTemplate('<ul id="'.$this->getWidgetID().'">'));
$repeater->setFooterTemplate(new TJuiSortableTemplate('</ul>'));
$repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->Data %></li>',null));
$repeater->setEmptyTemplate(new TJuiSortableTemplate('<ul></ul>'));