Skip to content

dataFeed

alternative data source for filtered and bound data

let dataFeed: string|WebixProxy|function
webix.grid({
dataFeed: "//docs.webix.com/samples/server/countries"
});

also check the next samples:

The dataFeed setting defines an alternative data source for

  • data components bound to other components to load data when it is requested by a master component.
url:"main/data", //loads data initially
dataFeed: "datafeed/data" //loads data afterwards

You can provide a URL string as a value for the dataFeed property. In the sample below it is used for server-side filtering of a combobox values.

// Filtering dataset with dataFeed as a string
webix.grid({
dataFeed: "//docs.webix.com/samples/server/countries"
});

In this case Grid’s dataFeed issues a GET request like ""url?filter[fieldID]=” + fieldValue”, where:

  • fieldID - ID of the field data used for filtering (“value” by default);
  • fieldValue - input value user typed in.

With dataFeed as a function, you can

  • manually send an Ajax request with the needed parameters
  • manually load or parse data into the component.

In the sample below the load method is used to load data and parse it to the list.

// Filtering dataset with dataFeed as a function
dataFeed: function(text) {
// clearing list from previous values
this.clearAll();
this.load("//docs.webix.com/samples/server/countries?filter[value]=" + text)
}

You can send an Ajax request manually and return a promise with the data:

dataFeed: function (text) {
return fetch("//docs.webix.com/samples/server/countries?filter[value]=" + text)
.then(response => response.json());
}

Articles