Class XJSONDataSource

All Implemented Interfaces:
HasHandlers, HasDataChangedHandlers, HasHandleErrorHandlers

public class XJSONDataSource extends DataSource
A DataSource preconfigured to use the "scriptInclude" transport (sometimes called "JSONP") for cross-domain calls to JSON services.

To use this DataSource, provide the URL of the service as DataSource.dataURL, and provide fields that describe the structure of the data you want to extract from the service's response.

DataSource.recordXPath and DataSourceField.valueXPath can be used to extract data from the JSON structure returned by the service. See Client-Side Data Integration for an overview of how to control what parts of the JSON structure are included in the DSResponse object, and hence provided to DataBoundComponents that are bound to this DataSource.

This XJSONDataSource is really a subclass of DataSource with just a few property settings:

     dataFormat : "json",
     dataTransport : "scriptInclude"
     callbackParam : "callback"
  
  • Constructor Details

    • XJSONDataSource

      public XJSONDataSource()
    • XJSONDataSource

      public XJSONDataSource(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static XJSONDataSource getOrCreateRef(JavaScriptObject jsObj)
    • create

      public JavaScriptObject create()
      Overrides:
      create in class DataSource
    • setDefaultProperties

      public static void setDefaultProperties(XJSONDataSource xJSONDataSourceProperties)
      Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties set on the SmartGWT class instance passed to this function before its underlying SmartClient JS object was created. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.

      Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.

      Parameters:
      xJSONDataSourceProperties - properties that should be used as new defaults when instances of this class are created
      See Also: