summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable
diff options
context:
space:
mode:
authorJens Klaer <kj.landwehr.software@gmail.com>2015-05-20 15:56:09 +0200
committerJens Klaer <kj.landwehr.software@gmail.com>2015-05-20 15:56:09 +0200
commit55338f1cf947b8593a3e23094d6feab625370e28 (patch)
treee8d714ed8afad949c9e3ee93cf1fcc0602d92b36 /demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable
parent0fb75d64f8dbcc98b4c06e7556125b94bf612819 (diff)
extended quichstart tutorial for TJuiControl option changes during callback
Diffstat (limited to 'demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable')
-rw-r--r--demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page30
-rw-r--r--demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php28
2 files changed, 46 insertions, 12 deletions
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;
+ }
</com:TStyleSheet>
<table class="sampletable">
<tr><td class="samplenote">
-Default options with a little css applied:
+Default options with a little css applied, change options during callback:
</td><td class="sampleaction" style="height:600px">
- <com:TJuiDraggable ID="drag1">
- Drag me around
+ <com:TJuiDraggable ID="drag1" CssClass="drag-lime">
+ Drag me around
+ <p><com:TActiveLabel ID="label3" /></p>
</com:TJuiDraggable>
- <com:TJuiDroppable OnDrop="drop1_ondrop" CssClass="drop-yellow">
- Drop it here!
- <br/><com:TActiveLabel ID="label1" />
+ <com:TJuiDroppable ID="drop1" OnDrop="drop1_ondrop" CssClass="drop-yellow" Options.accept=".drag-lime">
+ Drop it here!
+ <p><com:TActiveLabel ID="label1a" Text="is accepting lime draggable" /></p>
+ <p><com:TActiveLabel ID="label1b" /></p>
</com:TJuiDroppable>
- <com:TJuiDroppable OnDrop="drop2_ondrop" CssClass="drop-red">
- Drop it here!
- <br/><com:TActiveLabel ID="label2" />
+ <com:TJuiDroppable ID="drop2" OnDrop="drop2_ondrop" CssClass="drop-red">
+ Drop it here!
+ <p><com:TActiveLabel ID="label2a" Text="is NOT highlighted while dragging" /></p>
+ <p><com:TActiveLabel ID="label2b" /></p>
</com:TJuiDroppable>
+
+ <p><com:TActiveCheckBox Text="yellow droppable accepts lime draggable" OnCheckedChanged="drop1_changed" Checked="true" /></p>
+ <p><com:TActiveCheckBox Text="highlight red droppable while dragging" OnCheckedChanged="drop2_changed" /></p>
</td></tr>
</table>
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: <br/>Top=".$top." Left=".$left;
+ $this->label1b->Text="Dropped ".$draggable->ID." at: <br/>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: <br/>Top=".$top." Left=".$left;
+ $this->label2b->Text="Dropped ".$draggable->ID." at: <br/>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";
+ }
}
}