dataFeed
alternative data source for filtered and bound data
let dataFeed: string|WebixProxy|function
Example
Section titled “Example”webix.grid({ dataFeed: "//docs.webix.com/samples/server/countries"});
also check the next samples:
Details
Section titled “Details”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 initiallydataFeed: "datafeed/data" //loads data afterwards
Using as a string
Section titled “Using as a string”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 stringwebix.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.
Using as a function
Section titled “Using as a function”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 functiondataFeed: 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());}
See also
Section titled “See also”Articles