jQuery Engine Helper for JsHelper
Provides jQuery specific JavaScript for JsHelper.
Implements the JsHelper interface for jQuery. All $options arrays support all options found in the JsHelper, as well as those in the jQuery documentation.
$_callbackArguments
protected string
$_optionMap
protected array
$jQueryObject
public string
The variable name of the jQuery Object, useful when jQuery is put into noConflict() mode.
Create a domReady event. For jQuery. This method does not bind a 'traditional event' as $(document).bind('ready', fn)
Works in an entirely different fashion than $(document).ready()
The first will not run the function when eval()'d as part of a response The second will. Because of the way that ajax pagination is done $().ready()
is used.
Serialize a form attached to $selector. If the current selection is not an input or form, errors will be created in the JavaScript.
_methodTemplate( string $method , string $template , array $options , array $extraSafeKeys array() )
Helper function to wrap repetitive simple method templating.
$method
$template
$options
$extraSafeKeys
optional array() domReady( string $functionBody )
Create a domReady event. For jQuery. This method does not bind a 'traditional event' as $(document).bind('ready', fn)
Works in an entirely different fashion than $(document).ready()
The first will not run the function when eval()'d as part of a response The second will. Because of the way that ajax pagination is done $().ready()
is used.
$functionBody
drag( array $options array() )
Create a Draggable element
Requires both Ui.Core and Ui.Draggable to be loaded.
$options
optional array() drop( array $options array() )
Create a Droppable element
Requires both Ui.Core and Ui.Droppable to be loaded.
$options
optional array() each( string $callback )
Create an iteration over the current selection result.
$callback
effect( string $name , array $options array() )
Trigger an Effect.
$name
$options
optional array() event( string $type , string $callback , array $options array() )
Add an event to the script cache. Operates on the currently selected elements.
$type
$callback
$options
optional array() get( string $selector )
Create javascript selector for a CSS rule
$selector
JqueryEngineHelper
request( string|array $url , array $options array() )
Create an $.ajax() call.
If the 'update' key is set, success callback will be overridden.
$url
$options
optional array() serializeForm( array $options array() )
Serialize a form attached to $selector. If the current selection is not an input or form, errors will be created in the JavaScript.
$options
optional array() slider( array $options array() )
Create a Slider element
Requires both Ui.Core and Ui.Slider to be loaded.
$options
optional array() sortable( array $options array() )
Create a sortable element.
Requires both Ui.Core and Ui.Sortables to be loaded.
$options
optional array() _mapOptions( string $method , array $options )
Maps Abstract options to engine specific option names. If attributes are missing from the map, they are not changed.
$method
$options
_parseOptions( array $options , array $safeKeys array() )
Parse an options assoc array into a JavaScript object literal. Similar to object() but treats any non-integer value as a string, does not include { }
$options
$safeKeys
optional array() _prepareCallbacks( string $method , array $options , array $callbacks array() )
Prepare callbacks and wrap them with function ([args]) { } as defined in _callbackArgs array.
$method
$options
$callbacks
optional array() _processOptions( string $method , array $options )
Convenience wrapper method for all common option processing steps. Runs _mapOptions, _prepareCallbacks, and _parseOptions in order.
$method
$options
_toQuerystring( array $parameters )
Convert an array of data into a query string
$parameters
_utf8ToHex( string $string )
Encode a string into JSON. Converts and escapes necessary characters.
$string
alert( string $message )
Create an alert()
message in JavaScript
$message
confirm( string $message )
Create a confirm()
message
$message
confirmReturn( string $message )
Generate a confirm snippet that returns false from the current function scope.
$message
escape( string $string )
Escape a string to be JSON friendly.
List of escaped elements:
$string
object( array $data array() , array $options array() )
Generates a JavaScript object in JavaScript Object Notation (JSON) from an array. Will use native JSON encode method if available, and $useNative == true
prefix
- String prepended to the returned data.postfix
- String appended to the returned data.$data
optional array() $options
optional array() prompt( string $message , string $default '' )
Create a prompt()
JavaScript function
$message
$default
optional '' redirect( string|array $url null )
Redirects to a URL. Creates a window.location modification snippet that can be used to trigger 'redirects' from JavaScript.
$url
optional null value( mixed $val array() , boolean $quoteString null , string $key 'value' )
Converts a PHP-native variable of any type to a JSON-equivalent representation
$val
optional array() $quoteString
optional null $key
optional 'value' protected string
Callback arguments lists
array( 'slider' => array( 'start' => 'event, ui', 'slide' => 'event, ui', 'change' => 'event, ui', 'stop' => 'event, ui' ), 'sortable' => array( 'start' => 'event, ui', 'sort' => 'event, ui', 'change' => 'event, ui', 'beforeStop' => 'event, ui', 'stop' => 'event, ui', 'update' => 'event, ui', 'receive' => 'event, ui', 'remove' => 'event, ui', 'over' => 'event, ui', 'out' => 'event, ui', 'activate' => 'event, ui', 'deactivate' => 'event, ui' ), 'drag' => array( 'start' => 'event, ui', 'drag' => 'event, ui', 'stop' => 'event, ui', ), 'drop' => array( 'activate' => 'event, ui', 'deactivate' => 'event, ui', 'over' => 'event, ui', 'out' => 'event, ui', 'drop' => 'event, ui' ), 'request' => array( 'beforeSend' => 'XMLHttpRequest', 'error' => 'XMLHttpRequest, textStatus, errorThrown', 'success' => 'data, textStatus', 'complete' => 'XMLHttpRequest, textStatus', 'xhr' => '' ) )
protected array
Option mappings for jQuery
array( 'request' => array( 'type' => 'dataType', 'before' => 'beforeSend', 'method' => 'type', ), 'sortable' => array( 'complete' => 'stop', ), 'drag' => array( 'snapGrid' => 'grid', 'container' => 'containment', ), 'drop' => array( 'leave' => 'out', 'hover' => 'over' ), 'slider' => array( 'complete' => 'stop', 'direction' => 'orientation' ) )
public string
The variable name of the jQuery Object, useful when jQuery is put into noConflict() mode.
'$'
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/2.9/class-JqueryEngineHelper.html