Skip to content


Subversion checkout URL

You can clone with
Download ZIP


elishnevsky edited this page · 7 revisions
Clone this wiki locally

Advanced configuration and usage


By default no configuration is required at all to use Ext.Direct.Mvc. However, you can customize certain options in web.config of your project. What you need to do is create section. Here is an example:

        <section name="" type="Ext.Direct.Mvc.ProviderConfiguration, Ext.Direct.Mvc"/>

The following settings can be changed and all of them are optional:

  • name - Custom name for the remoting API object generated by Ext.Direct.Mvc. Default to
  • namespace - Namespace for generated proxy methods. Default is no namespace.
  • assembly - The name of the assembly which contains your Direct methods. Can have multiple assembly names separated by comma. If omitted then all referenced assemblies will be scanned.
  • buffer - Number that specifies the amount of time in milliseconds to wait before sending a batched request. If not specified then the default value, configured by Ext JS will be used, which is 10.
  • maxRetries - Number of times to re-attempt delivery on failure of a call. If not specified then the default value, configured by Ext JS will be used, which is 1.
  • timeout - The timeout to use for each request. If not specified then the default value defined by Ext JS will be used, which I don't remember :)
  • dateFormat - The format in which DateTime objects should be returned. Valid values are "ISO", "JS" or "JavaScript", all case insensitive. Anything else will format the dates using the ugly M$ format. Default is "ISO".
  • debug - Boolean. Set to true to include full stack trace in the exception response when an intercepted server exception is returned to the client. Default is false. It should NEVER be set to true on production environment because of security concerns!!!

Excluding controllers or action from Ext Direct

By default client-side stub methods are generated for all public actions in any controller that derives from DirectController. Most of the time it is what you want, but sometimes it may be necessary to exclude entire controller or individual actions from Ext Direct, so that stub methods will not be generated. This can be done by marking the actions or the controller with [DirectIgnore] attrubute, it will instruct Ext.Direct.Mvc to ignore them when creating the API object.

Handling server-side exceptions on the client

By default no server-side exception are intercepted except the special DirectException which you can throw from anywhere in your code. When a DirectException is thrown on the server, a direct response of type "exception" is returned to the client where you can decide what to do with it (see below). It is also possible to intercept any server-side exceptions in an entire controller or a single action and return it to the client as exception response. To do this you need to mark either the controller or individual actions with [DirectHandleError] attribute. A typical exception response object on the client will contain the following members:

  • type - "exception"
  • tid - The transaction id
  • action - The action that has been called
  • method - The method that has been called
  • message - The error message
  • where - The full stack trace from the server, available during debugging
  • result - Simple object with only "success" boolean property for form posts
  • errorData - User-defined information about the exception only if provided

The errorData is copied from Exception.Data. To read about Exception.Data and how to set it visit this page:

You can handle a server-side exception on the client either in an individual callback function:

Employees.Get(1234, function(result, response) {
   if (response.type == "exception") {
      // display or log the error
   // process the result

or globally

// in Ext JS 4'exception', function(error) {
    console.error(Ext.util.Format.format('{0}\n{1}', error.message, error.where));

// or in Ext JS 3
Ext.Direct.on('exception', function(error) {
    console.error(String.format('{0}\n{1}', error.message, error.where));

Server-side events

Ext.Direct supports custom server-side events. Mark an acton that should return an event with [DirectEvent] attribute to wrap its returned value in a special event response object and handle it on the client as described in the documentation for Direct manager.

Good luck!

Something went wrong with that request. Please try again.