Skip to main content

api.setNext()

Description

Allows adding some action into the Event Bus order

Usage

api.setNext(next: any): void;

Parameters

  • next - (required) the action to be included into the Event Bus order

Example

The example below shows how to use the api.setNext() method to integrate some custom class into the Event Bus order:

const table = new pivot.Pivot("#root", { fields: [], data: [] });
const server = "https://some-backend-url";

// Assume you have a custom server service class named someServerService
const someServerService = new ServerDataService(server);

Promise.all([
fetch(server + "/data").then((res) => res.json()),
fetch(server + "/fields").then((res) => res.json())
]).then(([data, fields]) => {
table.setConfig({ data, fields });

// Integrate the serverDataService into the Event Bus order of widget
table.api.setNext(someServerService);
});

Related articles: setConfig