diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2014-02-06 16:23:42 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2014-02-06 16:23:42 +0100 |
commit | 2c1d9d453404ec2e3344ef477bf834a2a3c065af (patch) | |
tree | d309eca34de724db2804e0febaab76a68b50b889 /framework/Web/Javascripts/source | |
parent | 705a311b3bbc223737a51bec1d2f978554da086a (diff) |
Implemented basic support for callback events for JUI controls; TJuiDraggable and TJuiDroppable examples
Diffstat (limited to 'framework/Web/Javascripts/source')
-rw-r--r-- | framework/Web/Javascripts/source/prado/activecontrols/ajax3.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js index e6616176..98802b0a 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js @@ -893,6 +893,44 @@ Prado.Callback = function(UniqueID, parameter, onSuccess, options) }; /** + * Create a new callback request initiated by jQuery-UI elements. + * @param event object as sent by jQuery-UI events + * @param ui object as sent by jQuery-UI events + * @return boolean always false. + */ +Prado.JuiCallback = function(UniqueID, eventType, event, ui, target) +{ + // Retuns an array of all properties of the object received as parameter and their values. + // If a property represent a jQuery element, its id is returnet instead + var cleanUi = {}; + jQuery.each( ui, function( key, value ) { + if(value instanceof jQuery) + cleanUi[key]=value[0].id; + else + cleanUi[key]=value; + }); + + target=jQuery(target); + cleanUi['target']= { + 'position' : target.position(), + 'offset' : target.offset() + }; + + var callback = + { + 'EventTarget' : UniqueID, + 'CallbackParameter' : { + 'event' : eventType, + 'ui' : cleanUi + }, + }; + + var request = new Prado.CallbackRequest(UniqueID, callback); + request.dispatch(); + return false; +}; + +/** * Asset manager classes for lazy loading of scripts and stylesheets * @author Gabor Berczi (gabor.berczi@devworx.hu) */ |