Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
b6944f80
Commit
b6944f80
authored
Feb 22, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed Jui sortable clientEvents naming
fixes #2514
parent
26717e3e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
3 deletions
+34
-3
CHANGELOG.md
extensions/jui/CHANGELOG.md
+2
-1
Sortable.php
extensions/jui/Sortable.php
+20
-1
Widget.php
extensions/jui/Widget.php
+12
-1
No files found.
extensions/jui/CHANGELOG.md
View file @
b6944f80
...
...
@@ -4,7 +4,8 @@ Yii Framework 2 jui extension Change Log
2.
0.0 beta under development
----------------------------
-
Bug #1550: fixed the issue that JUI input widgets did not property input IDs.
-
Bug #1550: fixed the issue that JUI input widgets did not property input IDs. (qiangxue)
-
Bug #2514: Jui sortable clientEvents were not working because of wrong naming assumptions. (cebe)
2.
0.0 alpha, December 1, 2013
-----------------------------
...
...
extensions/jui/Sortable.php
View file @
b6944f80
...
...
@@ -29,7 +29,7 @@ use yii\helpers\Html;
* 'options' => ['tag' => 'ul'],
* 'itemOptions' => ['tag' => 'li'],
* 'clientOptions' => ['cursor' => 'move'],
*
)
);
*
]
);
* ```
*
* @see http://api.jqueryui.com/sortable/
...
...
@@ -65,6 +65,25 @@ class Sortable extends Widget
*/
public
$itemOptions
=
[];
/**
* @inheritDoc
*/
protected
$clientEventMap
=
[
'activate'
=>
'sortactivate'
,
'beforeStop'
=>
'sortbeforestop'
,
'change'
=>
'sortchange'
,
'create'
=>
'sortcreate'
,
'deactivate'
=>
'sortdeactivate'
,
'out'
=>
'sortout'
,
'over'
=>
'sortover'
,
'receive'
=>
'sortreceive'
,
'remove'
=>
'sortremove'
,
'sort'
=>
'sort'
,
'start'
=>
'sortstart'
,
'stop'
=>
'sortstop'
,
'update'
=>
'sortupdate'
,
];
/**
* Renders the widget.
...
...
extensions/jui/Widget.php
View file @
b6944f80
...
...
@@ -38,6 +38,16 @@ class Widget extends \yii\base\Widget
* Please refer to the corresponding jQuery UI widget Web page for possible events.
* For example, [this page](http://api.jqueryui.com/accordion/) shows
* how to use the "Accordion" widget and the supported events (e.g. "create").
* Keys are the event names and values are javascript code that is passed to the `.on()` function
* as the event handler.
*
* For example you could write the following in your widget configuration:
*
* ```php
* 'clientEvents' => [
* 'change' => 'function() { alert('event "change" occured.'); }'
* ],
* ```
*/
public
$clientEvents
=
[];
...
...
@@ -47,6 +57,7 @@ class Widget extends \yii\base\Widget
*/
protected
$clientEventMap
=
[];
/**
* Initializes the widget.
* If you override this method, make sure you call the parent implementation first.
...
...
@@ -99,7 +110,7 @@ class Widget extends \yii\base\Widget
if
(
isset
(
$this
->
clientEventMap
[
$event
]))
{
$eventName
=
$this
->
clientEventMap
[
$event
];
}
else
{
$eventName
=
$name
.
$event
;
$eventName
=
strtolower
(
$name
.
$event
)
;
}
$js
[]
=
"jQuery('#
$id
').on('
$eventName
',
$handler
);"
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment