Back to Devexpress

FetchRemoteService Class

dashboard-js-devexpress-dot-dashboard-356a220a.md

latest5.7 KB
Original Source

FetchRemoteService Class

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

Declaration

ts
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

ts
constructor(
    options?: DevExpress.Dashboard.FetchRemoteServiceOptions
)

Parameters

NameType
optionsFetchRemoteServiceOptions

Properties

beforeSend Property

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

Declaration

ts
beforeSend: (settings: RequestInit) => void

Property Value

TypeDescription
(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

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

Property Value

TypeDescription
[key: string]: any

A collections of header key/value pairs.

|

Methods

getFromServer(url) Method

Requests data from the server using the GET method.

Declaration

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

Parameters

NameTypeDescription
urlstring

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

TypeDescription
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

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

Parameters

NameTypeDescription
urlstring

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

TypeDescription
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

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

Parameters

NameTypeDescription
urlstring

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

TypeDescription
JQueryPromise<any>

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

|