From 55338f1cf947b8593a3e23094d6feab625370e28 Mon Sep 17 00:00:00 2001 From: Jens Klaer Date: Wed, 20 May 2015 15:56:09 +0200 Subject: extended quichstart tutorial for TJuiControl option changes during callback --- .../JuiControls/Samples/TJuiDroppable/Home.page | 30 ++++++++++++++-------- .../JuiControls/Samples/TJuiDroppable/Home.php | 28 ++++++++++++++++++-- 2 files changed, 46 insertions(+), 12 deletions(-) (limited to 'demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable') diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page index 6059fe60..6b527375 100644 --- a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page @@ -5,9 +5,10 @@ .ui-draggable { width: 100px; height:100px; - background-color: lime; border: 1px solid black; + background-color: lime; padding: 1em; + cursor: move; } .ui-droppable { width: 150px; @@ -22,25 +23,34 @@ .drop-red { background-color: red; } + .drop-red.active { + background-color: orange; + }
-Default options with a little css applied: +Default options with a little css applied, change options during callback: - - Drag me around + + Drag me around +

- - Drop it here! -
+ + Drop it here! +

+

- - Drop it here! -
+ + Drop it here! +

+

+ +

+

diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php index c59d035c..69139e9d 100644 --- a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php @@ -12,7 +12,8 @@ class Home extends TPage $target=$param->getCallbackParameter()->target->offset; $top=$offset->top - $target->top; $left=$offset->left - $target->left; - $this->label1->Text="Dropped ".$draggable->ID." at:
Top=".$top." Left=".$left; + $this->label1b->Text="Dropped ".$draggable->ID." at:
Top=".$top." Left=".$left; + $this->label3->Text="Dropped into yellow droppable!"; } public function drop2_ondrop($sender, $param) @@ -25,6 +26,29 @@ class Home extends TPage $target=$param->getCallbackParameter()->target->offset; $top=$offset->top - $target->top; $left=$offset->left - $target->left; - $this->label2->Text="Dropped ".$draggable->ID." at:
Top=".$top." Left=".$left; + $this->label2b->Text="Dropped ".$draggable->ID." at:
Top=".$top." Left=".$left; + $this->label3->Text="Dropped into red droppable!"; + } + + public function drop1_changed($sender, $param) { + if ($sender->getChecked()) { + $this->drop1->getOptions()->accept = '.drag-lime'; + $this->label1a->Text="is accepting lime draggable"; + } + else { + $this->drop1->getOptions()->accept = ''; + $this->label1a->Text="is NOT accepting lime draggable"; + } + } + + public function drop2_changed($sender, $param) { + if ($sender->getChecked()) { + $this->drop2->getOptions()->activeClass = 'active'; + $this->label2a->Text="is highlighted while dragging"; + } + else { + $this->drop2->getOptions()->activeClass = ''; + $this->label2a->Text="is NOT highlighted while dragging"; + } } } -- cgit v1.2.3