PDA

View Full Version : Ext.tux.util.Sortable - Provides more informations on the dragged element.



AndreaCammarata
24 Aug 2011, 2:13 PM
Hi guys.
Before to release the Ext.tux.EditableList (http://www.sencha.com/forum/showthread.php?144737-Ext.tux.EditableList-Improved-list-component.) component, I want to share some improvements done to the Ext.util.Sortable object. This is nothing exceptional, but I had to create this to makes possible to handle the sorting and the Store index swapping inside the upcoming Ext.tux.EditableList (http://www.sencha.com/forum/showthread.php?144737-Ext.tux.EditableList-Improved-list-component.), so someone of you can find it useful. You will have to download this in order to use the new List component, but don't worry, I will post full detailed instructions on how to use that.

In details I have edited three events to provide more informations about the dragged elements.
Here is what is changed:



/*
* @event sortstart
* @param {Ext.Sortable} this
* @param {Ext.EventObject} e The event object.
* @param {Number} oldIndex The index of the element before the sort change.
*
* @event sortend
* @param {Ext.Sortable} this
* @param {Ext.Element} el The Element being dragged.
* @param {Ext.EventObject} e The event object.
* @param {Number} oldIndex The index of the element before the sort change.
* @param {Number} newIndex The index of the element after the sort change.
*
* @event sortchange
* @param {Ext.Sortable} this
* @param {Ext.Element} el The Element being dragged.
* @param {Number} oldIndex The index of the element before the sort change.
* @param {Number} newIndex The index of the element after the sort change.
*
*/


You can download this from github at the following address:
https://github.com/AndreaCammarata/Ext.tux.util.Sortable

Hope this helps.