X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..c8256059947f3aa8f5b0a9a2acf55e2142bb4742:/docs/output/Ext.Direct.html diff --git a/docs/output/Ext.Direct.html b/docs/output/Ext.Direct.html index 4b3237d6..8ec8c60b 100644 --- a/docs/output/Ext.Direct.html +++ b/docs/output/Ext.Direct.html @@ -1,40 +1,40 @@ -
Observable Direct
Package: | Ext |
Defined In: | Direct.js |
Class: | Direct |
Extends: | Observable |
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);
+Observable
Direct
Class Ext.Direct
Package: Ext Defined In: Direct.js Class: Direct Extends: Observable
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:
+- JsonProvider for simple JSON operations
+- PollingProvider for repeated requests
+- RemotingProvider exposes server side
+on the client.
+
+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
Config Options Defined By 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
@@ -90,24 +90,26 @@ Ext.DomObserver = Ext.extend(Object, {
typeAhead: true,
mode: 'local',
triggerAction: 'all'
-});
Observable
Public Properties
Property Defined By 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 Methods
Method Defined By addEvents( Object object
)
+}); Observable
Public Properties
Property Defined By 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
Method Defined By addEvents( Object|String o
, string Optional.
)
:
- voidUsed to define events on this ObservableUsed to define events on this ObservableParameters:object
: ObjectThe object with the events defined
Returns:- void
Observable addListener( String eventName
, Function handler
, [Object scope
], [Object options
] )
+ 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.Parameters:o
: Object|StringEither an object with event names as properties with a value of true
+or the first event name string if multiple event names are being passed as separate parameters.Optional.
: stringEvent name if multiple event names are being passed as separate parameters.
+Usage:this.addEvents('storeloaded', 'storecleared');
Returns:- void
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.
@@ -128,8 +130,8 @@ Using the options argument, it is possible to combine different types of listene
A delayed, one-time listener.
myDataView.on('click', this.onClick, this, {
- single: true,
- delay: 100
+single: true,
+delay: 100
});
Attaching multiple handlers in 1 call
@@ -137,75 +139,107 @@ The method also allows for a single argument to be passed which is a config obje
which specify multiple handlers.
myGridPanel.on({
- 'click' : {
- fn: this.onClick,
- scope: this,
- delay: 100
- },
- 'mouseover' : {
- fn: this.onMouseOver,
- scope: this
- },
- 'mouseout' : {
- fn: this.onMouseOut,
- scope: this
- }
+'click' : {
+ fn: this.onClick,
+ scope: this,
+ delay: 100
+},
+'mouseover' : {
+ fn: this.onMouseOver,
+ scope: this
+},
+'mouseout' : {
+ fn: this.onMouseOut,
+ scope: this
+}
});
Or a shorthand syntax:
myGridPanel.on({
- 'click' : this.onClick,
- 'mouseover' : this.onMouseOver,
- 'mouseout' : this.onMouseOut,
- scope: this
+'click' : this.onClick,
+'mouseover' : this.onMouseOver,
+'mouseout' : this.onMouseOut,
+ scope: this
});
Returns:- void
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
-);
Parameters:provider
: Object/ArrayAccepts either an Array of Provider descriptions (an instance
-or config object for a Provider) or any number of Provider descriptions as arguments. Each
-Provider description instructs Ext.Direct how to create client-side stub methods.
Returns:- void
Direct enableBubble( Object events
)
+ 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
+);
Parameters:provider
: Object/ArrayAccepts either an Array of Provider descriptions (an instance
+or config object for a Provider) or any number of Provider descriptions as arguments. Each
+Provider description instructs Ext.Direct how to create client-side stub methods.
Returns:- void
Direct enableBubble( String/Array events
)
:
- voidUsed to enable bubbling of eventsUsed to enable bubbling of eventsParameters:events
: Object
Returns:- void
Observable fireEvent( String eventName
, Object... args
)
+ 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');
+ }
+ }
+});
Parameters:events
: String/ArrayThe event name to bubble, or an Array of event names.
Returns:- void
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...Fires the specified event with the passed parameters (minus the event name).
An event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget)
by calling enableBubble.
Parameters:eventName
: StringThe name of the event to fire.args
: Object...Variable number of parameters are passed to handlers.
Returns:Boolean
returns false if any of the handlers return false otherwise it returns true.
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
+ 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:- void
Direct hasListener( String eventName
)
:
BooleanChecks to see if this object has any listeners for a specified eventChecks to see if this object has any listeners for a specified eventParameters:eventName
: StringThe name of the event to check for
Returns:Boolean
True if the event is being listened for, else false
Observable on( String eventName
, Function handler
, [Object scope
], [Object options
] )