| listeners : ObjectA config object containing one or more event handlers to be added to this
+ Overview
+ Ext.Direct aims to streamline communication between the client and server
+by providing a single interface that reduces the amount of common code
+typically required to validate data and handle returned data packets
+(reading data, error conditions, etc).
+ The Ext.direct namespace includes several classes for a closer integration
+with the server-side. The Ext.data namespace also includes classes for working
+with Ext.data.Stores which are backed by data from an Ext.Direct method.
+ Specification
+ For additional information consult the
+Ext.Direct Specification.
+ Providers
+ Ext.Direct uses a provider architecture, where one or more providers are
+used to transport data to and from the server. There are several providers
+that exist in the core at the moment:
+ A provider does not need to be invoked directly, providers are added via
+Ext.Direct.add.
+ Router
+ Ext.Direct utilizes a "router" on the server to direct requests from the client
+to the appropriate server-side method. Because the Ext.Direct API is completely
+platform-agnostic, you could completely swap out a Java based server solution
+and replace it with one that uses C# without changing the client side JavaScript
+at all.
+ Server side events
+ Custom events from the server may be handled by the client by adding
+listeners, for example:
+ {"type":"event","name":"message","data":"Successfully polled at: 11:19:30 am"}
+
+// add a handler for a 'message' event sent by the server
+Ext.Direct.on('message', function(e){
+ out.append(String.format('<p><i>{0}</i></p>', e.data));
+ out.el.scrollTo('t', 100000, true);
+}); This class is a singleton and cannot be created directly.Config Options|
| listeners : ObjectA config object containing one or more event handlers to be added to this
object during initialization. This should ... A config object containing one or more event handlers to be added to this
object during initialization. This should be a valid listeners config object as specified in the
addListener example for attaching multiple handlers at once.
@@ -90,27 +91,27 @@ Ext.DomObserver = Ext.extend(Object, {
typeAhead: true,
mode: 'local',
triggerAction: 'all'
-}); | Observable |
Public Properties|
| eventTypes : ObjectEach event type implements a getData() method. The default event types are:
-<div class="mdetail-params">
-event : Ex... Each event type implements a getData() method. The default event types are:
-
-- event : Ext.Direct.Event
-- exception : Ext.Direct.ExceptionEvent
-- rpc : Ext.Direct.RemotingEvent
- | Direct | | exceptions : ObjectFour types of possible exceptions which can occur:
-<div class="mdetail-params">
-Ext.Direct.exceptions.TRANSPORT : '... Four types of possible exceptions which can occur:
-
-- Ext.Direct.exceptions.TRANSPORT : 'xhr'
-- Ext.Direct.exceptions.PARSE : 'parse'
-- Ext.Direct.exceptions.LOGIN : 'login'
-- Ext.Direct.exceptions.SERVER : 'exception'
- | Direct |
Public MethodsPublic Properties|
| eventTypes : ObjectEach event type implements a getData() method. The default event types are:
+<div class="mdetail-params">
+event : Ext.... Each event type implements a getData() method. The default event types are:
+
+- event : Ext.Direct.Event
+- exception : Ext.Direct.ExceptionEvent
+- rpc : Ext.Direct.RemotingEvent
+ | Direct | | exceptions : ObjectFour types of possible exceptions which can occur:
+<div class="mdetail-params">
+Ext.Direct.exceptions.TRANSPORT : 'xh... Four types of possible exceptions which can occur:
+
+- Ext.Direct.exceptions.TRANSPORT : 'xhr'
+- Ext.Direct.exceptions.PARSE : 'parse'
+- Ext.Direct.exceptions.LOGIN : 'login'
+- Ext.Direct.exceptions.SERVER : 'exception'
+ | Direct |
Public Methods|
| addEvents( Object|String o , string Optional. )
+ :
voidAdds the specified events to the list of events which this Observable may fire. Adds the specified events to the list of events which this Observable may fire. | Observable | | addListener( String eventName , Function handler , [Object scope ], [Object options ] )
- :
+Usage:this.addEvents('storeloaded', 'storecleared'); Returns: | Observable | | addListener( String eventName , Function handler , [Object scope ], [Object options ] )
+ :
voidAppends an event handler to this object. Appends an event handler to this object. Parameters:eventName : StringThe name of the event to listen for. handler : FunctionThe method the event invokes. scope : Object(optional) The scope (this reference) in which the handler function is executed.
If omitted, defaults to the object which fired the event. options : Object(optional) An object containing handler configuration.
properties. This may contain any of the following properties:
@@ -160,110 +161,110 @@ Or a shorthand syntax:
'mouseover' : this.onMouseOver,
'mouseout' : this.onMouseOut,
scope: this
-}); Returns: | Observable | | addProvider( Object/Array provider )
- :
- voidAdds an Ext.Direct Provider and creates the proxy or stub methods to execute server-side methods.
-If the provider is... Adds an Ext.Direct Provider and creates the proxy or stub methods to execute server-side methods.
-If the provider is not already connected, it will auto-connect.
- var pollProv = new Ext.direct.PollingProvider({
- url: 'php/poll2.php'
-});
-
-Ext.Direct.addProvider(
- {
- "type":"remoting", // create a Ext.direct.RemotingProvider
- "url":"php\/router.php", // url to connect to the Ext.Direct server-side router.
- "actions":{ // each property within the actions object represents a Class
- "TestAction":[ // array of methods within each server side Class
- {
- "name":"doEcho", // name of method
- "len":1
- },{
- "name":"multiply",
- "len":1
- },{
- "name":"doForm",
- "formHandler":true, // handle form on server with Ext.Direct.Transaction
- "len":1
- }]
- },
- "namespace":"myApplication",// namespace to create the Remoting Provider in
- },{
- type: 'polling', // create a Ext.direct.PollingProvider
- url: 'php/poll.php'
- },
- pollProv // reference to previously created instance
-);
| Direct | | enableBubble( String/Array events )
- :
- voidEnables events fired by this Observable to bubble up an owner hierarchy by calling
-this.getBubbleTarget() if present... Enables events fired by this Observable to bubble up an owner hierarchy by calling
-this.getBubbleTarget() if present. There is no implementation in the Observable base class.
- This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component.getBubbleTarget. The default
-implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to
-access the required target more quickly.
- Example: Ext.override(Ext.form.Field, {
- // Add functionality to Field's initComponent to enable the change event to bubble
- initComponent : Ext.form.Field.prototype.initComponent.createSequence(function() {
- this.enableBubble('change');
- }),
-
- // We know that we want Field's events to bubble directly to the FormPanel.
- getBubbleTarget : function() {
- if (!this.formPanel) {
- this.formPanel = this.findParentByType('form');
- }
- return this.formPanel;
- }
-});
-
-var myForm = new Ext.formPanel({
- title: 'User Details',
- items: [{
- ...
- }],
- listeners: {
- change: function() {
- // Title goes red if form has been modified.
- myForm.header.setStyle('color', 'red');
- }
- }
-});
| Observable | | fireEvent( String eventName , Object... args )
- :
- BooleanFires the specified event with the passed parameters (minus the event name).
+}); Returns: | Observable | | addProvider( Object/Array provider )
+ :
+ voidAdds an Ext.Direct Provider and creates the proxy or stub methods to execute server-side methods.
+If the provider is ... Adds an Ext.Direct Provider and creates the proxy or stub methods to execute server-side methods.
+If the provider is not already connected, it will auto-connect.
+ var pollProv = new Ext.direct.PollingProvider({
+ url: 'php/poll2.php'
+});
+
+Ext.Direct.addProvider(
+ {
+ "type":"remoting", // create a Ext.direct.RemotingProvider
+ "url":"php\/router.php", // url to connect to the Ext.Direct server-side router.
+ "actions":{ // each property within the actions object represents a Class
+ "TestAction":[ // array of methods within each server side Class
+ {
+ "name":"doEcho", // name of method
+ "len":1
+ },{
+ "name":"multiply",
+ "len":1
+ },{
+ "name":"doForm",
+ "formHandler":true, // handle form on server with Ext.Direct.Transaction
+ "len":1
+ }]
+ },
+ "namespace":"myApplication",// namespace to create the Remoting Provider in
+ },{
+ type: 'polling', // create a Ext.direct.PollingProvider
+ url: 'php/poll.php'
+ },
+ pollProv // reference to previously created instance
+);
| Direct | | enableBubble( String/Array events )
+ :
+ voidEnables events fired by this Observable to bubble up an owner hierarchy by calling
+this.getBubbleTarget() if present.... Enables events fired by this Observable to bubble up an owner hierarchy by calling
+this.getBubbleTarget() if present. There is no implementation in the Observable base class.
+ This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component.getBubbleTarget. The default
+implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to
+access the required target more quickly.
+ Example: Ext.override(Ext.form.Field, {
+ // Add functionality to Field's initComponent to enable the change event to bubble
+ initComponent : Ext.form.Field.prototype.initComponent.createSequence(function() {
+ this.enableBubble('change');
+ }),
+
+ // We know that we want Field's events to bubble directly to the FormPanel.
+ getBubbleTarget : function() {
+ if (!this.formPanel) {
+ this.formPanel = this.findParentByType('form');
+ }
+ return this.formPanel;
+ }
+});
+
+var myForm = new Ext.formPanel({
+ title: 'User Details',
+ items: [{
+ ...
+ }],
+ listeners: {
+ change: function() {
+ // Title goes red if form has been modified.
+ myForm.header.setStyle('color', 'red');
+ }
+ }
+});
| Observable | | fireEvent( String eventName , Object... args )
+ :
+ BooleanFires the specified event with the passed parameters (minus the event name).
An event may be set to bubble up an Obse... | Observable | | getProvider( String id )
- :
- voidRetrieve a provider by the
-id specified when the provider is
-added. Retrieve a provider by the
- id specified when the provider is
- added. Parameters:id : StringUnique identifier assigned to the provider when calling addProvider Returns: | Direct | | hasListener( String eventName )
- :
- BooleanChecks to see if this object has any listeners for a specified event Checks to see if this object has any listeners for a specified event | Observable | | on( String eventName , Function handler , [Object scope ], [Object options ] )
- :
+by calling enableBubble. | Observable | | getProvider( String id )
+ :
+ voidRetrieve a provider by the
+id specified when the provider is
+added. Retrieve a provider by the
+ id specified when the provider is
+ added. Parameters:id : StringUnique identifier assigned to the provider when calling addProvider Returns: | Direct | | hasListener( String eventName )
+ :
+ BooleanChecks to see if this object has any listeners for a specified event Checks to see if this object has any listeners for a specified event | Observable | | on( String eventName , Function handler , [Object scope ], [Object options ] )
+ :
voidAppends an event handler to this object (shorthand for addListener.) Appends an event handler to this object (shorthand for addListener.) Parameters:eventName : StringThe type of event to listen for handler : FunctionThe method the event invokes scope : Object(optional) The scope (this reference) in which the handler function is executed.
-If omitted, defaults to the object which fired the event. options : Object(optional) An object containing handler configuration. Returns: | Observable | | purgeListeners()
- :
- voidRemoves all listeners for this object Removes all listeners for this object | Observable | | relayEvents( Object o , Array events )
- :
- voidRelays selected events from the specified Observable as if the events were fired by this. Relays selected events from the specified Observable as if the events were fired by this. | Observable | | removeListener( String eventName , Function handler , [Object scope ] )
- :
- voidRemoves an event handler. Removes an event handler. | Observable | | resumeEvents()
- :
- voidResume firing events. (see suspendEvents)
-If events were suspended using the queueSuspended parameter, then all
+If omitted, defaults to the object which fired the event. options : Object(optional) An object containing handler configuration. Returns: | Observable | | purgeListeners()
+ :
+ voidRemoves all listeners for this object Removes all listeners for this object | Observable | | relayEvents( Object o , Array events )
+ :
+ voidRelays selected events from the specified Observable as if the events were fired by this. Relays selected events from the specified Observable as if the events were fired by this. | Observable | | removeListener( String eventName , Function handler , [Object scope ] )
+ :
+ voidRemoves an event handler. Removes an event handler. | Observable | | resumeEvents()
+ :
+ voidResume firing events. (see suspendEvents)
+If events were suspended using the queueSuspended parameter, then all
event... Resume firing events. (see suspendEvents)
If events were suspended using the queueSuspended parameter, then all
-events fired during event suspension will be sent to any listeners now. | Observable | | suspendEvents( Boolean queueSuspended )
- :
+events fired during event suspension will be sent to any listeners now. | Observable | | suspendEvents( Boolean queueSuspended )
+ :
voidSuspend the firing of all events. (see resumeEvents) Suspend the firing of all events. (see resumeEvents) Parameters:queueSuspended : BooleanPass as true to queue up suspended events to be fired
-after the resumeEvents call instead of discarding all suspended events; Returns: | Observable | | un( String eventName , Function handler , [Object scope ] )
- :
- voidRemoves an event handler (shorthand for removeListener.) | Observable |
Public Events|
| event :
- ( event e , Ext.direct.Provider provider )
- Fires after an event. Fires after an event. Listeners will be called with the following arguments:e : eventprovider : Ext.direct.Provider
| Direct | | exception :
- ( event e )
+after the resumeEvents call instead of discarding all suspended events;Returns: | Observable | | un( String eventName , Function handler , [Object scope ] )
+ :
+ voidRemoves an event handler (shorthand for removeListener.) | Observable |
Public Events|
| event :
+ ( event e , Ext.direct.Provider provider )
+ Fires after an event. Fires after an event. Listeners will be called with the following arguments:e : eventprovider : Ext.direct.Provider
| Direct | | exception :
+ ( event e )
Fires after an event exception. Fires after an event exception. Listeners will be called with the following arguments: | Direct |
\ No newline at end of file
|