Clear Up
SharpKit Reference

Ext.direct Namespace

Download SDK: SharpKit.ExtJs.zip

Classes

Name Description
Event

A base class for all Ext.direct events. An event is created after some kind of interaction with the server. The event class is essentially just a data structure to hold a Direct response.

EventConfig
EventEvents
ExceptionEvent

An event that is fired when an exception is received from a Ext.direct.RemotingProvider

ExceptionEventConfig
ExceptionEventEvents
JsonProvider

A base provider for communicating using JSON. This is an abstract class and should not be instanced directly.

JsonProviderConfig
JsonProviderEvents
Manager

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.Manager.addProvider.

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.Manager.on('message', function(e){
            out.append(String.format('<p><i>{0}</i></p>', e.data));
            out.el.scrollTo('t', 100000, true);
            });
            
ManagerConfig
ManagerEvents
PollingProvider

Provides for repetitive polling of the server at distinct intervals. The initial request for data originates from the client, and then is responded to by the server.

All configurations for the PollingProvider should be generated by the server-side API portion of the Ext.Direct stack.

An instance of PollingProvider may be created directly via the new keyword or by simply specifying type = 'polling'. For example:

  
var pollA = new Ext.direct.PollingProvider({
            type:'polling',
            url: 'php/pollA.php',
            });
            Ext.direct.Manager.addProvider(pollA);
            pollA.disconnect();
            Ext.direct.Manager.addProvider(
            {
            type:'polling',
            url: 'php/pollB.php',
            id: 'pollB-provider'
            }
            );
            var pollB = Ext.direct.Manager.getProvider('pollB-provider');
            
PollingProviderConfig
PollingProviderEvents
Provider

Ext.direct.Provider is an abstract class meant to be extended.

For example Ext JS implements the following subclasses:

  
Provider
            |
            +---JsonProvider
            |
            +---PollingProvider
            |
            +---RemotingProvider
ProviderConfig
ProviderEvents
RemotingEvent

An event that is fired when data is received from a Ext.direct.RemotingProvider. Contains a method to the related transaction for the direct request, see getTransaction

RemotingEventConfig
RemotingEventEvents
RemotingMethod

NOTE This is a private utility class for internal use by the framework. Don't rely on its existence.

Small utility class used internally to represent a Direct method.

RemotingMethodConfig
RemotingMethodEvents
RemotingProvider

The RemotingProvider exposes access to server side methods on the client (a remote procedure call (RPC) type of connection where the client can initiate a procedure on the server).

This allows for code to be organized in a fashion that is maintainable, while providing a clear path between client and server, something that is not always apparent when using URLs.

To accomplish this the server-side needs to describe what classes and methods are available on the client-side. This configuration will typically be outputted by the server-side Ext.Direct stack when the API description is built.

RemotingProviderConfig
RemotingProviderEvents
Transaction

Supporting Class for Ext.Direct (not intended to be used directly).

TransactionConfig
TransactionEvents
© Copyright 2005-2011 SharpKit. All rights reserved.