Skip to main content
All docs
V25.1
  • FetchRemoteService Class

    The Fetch-based remote service used to communicate with the server side.

    Declaration

    export class FetchRemoteService implements IRemoteService<JQueryPromise<any>>

    Remarks

    The Fetch remote service is a default IRemoteService<TResponse> implementation that exchanges information between client and server sides. You can get different information from a server (data sources, export information, a dashboard model), obtain a dashboard request time, pass custom HTTP headers and more.

    Refer to the following topics for information on how to set the server’s URL and pass a custom Authorization header from the client:

    You can also view the following example on GitHub:

    View Example: ASP.NET Core Dashboard - How to implement authentication

    Refer to the FetchRemoteServiceOptions class for Fetch remote service options.

    You can use Web Forms, MVC, and ASP.NET Core dashboard applications as a client for a server part. See the following topic to learn more: DashboardBackendOptions.

    Implements

    IRemoteService

    constructor

    Initializes a new instance of the FetchRemoteService class with specified settings.

    Declaration

    constructor(
        options?: DevExpress.Dashboard.FetchRemoteServiceOptions
    )

    Parameters

    Name Type
    options FetchRemoteServiceOptions

    Properties

    beforeSend Property

    Specifies a pre-request callback function that allows you to modify the options parameter before the request is sent.

    Declaration

    beforeSend: (settings: RequestInit) => void

    Property Value

    Type Description
    (settings: RequestInit) => void

    A function that can be used to modify the options parameter before the Fetch request is sent.

    headers Property

    Specifies an object with additional headers (key/value pairs) to send along with requests.

    Declaration

    headers: {
        [key: string]: any;
    }

    Property Value

    Type Description
    [key: string]: any

    A collections of header key/value pairs.

    Methods

    getFromServer(url) Method

    Requests data from the server using the GET method.

    Declaration

    getFromServer(
        url: string,
        data?: Object,
        queryOptions?: Object,
        abortController?: AbortController
    ): JQueryPromise<any>

    Parameters

    Name Type Description
    url string

    A string containing the URL to which the request is sent.

    data Object

    Data to be sent to the server.

    queryOptions Object

    An object that contains query options.

    abortController AbortController

    An AbortController object that allows you to abort one or more Web requests.

    Returns

    Type Description
    JQueryPromise<any>

    A JQuery Promise object that is resolved after the action is completed.

    performPostback(url, args) Method

    Performs an export request to the server using the POST method.

    Declaration

    performPostback(
        url: string,
        args: any,
        abortController?: AbortController
    ): JQueryPromise<any>

    Parameters

    Name Type Description
    url string

    A string containing the URL to which the request is sent.

    args any

    An object that contains request options.

    abortController AbortController

    An AbortController object that allows you to abort one or more Web requests.

    Returns

    Type Description
    JQueryPromise<any>

    A JQuery Promise object that is resolved after the action is completed.

    postToServer(url) Method

    Posts data to the server using the POST method.

    Declaration

    postToServer(
        url: string,
        data?: Object,
        abortController?: AbortController
    ): JQueryPromise<any>

    Parameters

    Name Type Description
    url string

    A string containing the URL to which the request is sent.

    data Object

    Data to be sent to the server.

    abortController AbortController

    An AbortController object that allows you to abort one or more Web requests.

    Returns

    Type Description
    JQueryPromise<any>

    A JQuery Promise object that is resolved after the action is completed.