Skip to content

Loading Data into DataGrid: Overview

DataGrid can load data of various formats, such as:

  • JSON;
  • XML;
  • JsArray;
  • CSV.

Examples of data formats

In addition to the mentioned above, you can define any custom format.

There are two main ways of loading data in DataGrid:

  • define the data source in the object constructor;
  • use the parse or the load method.

Both ways work in the same way.

webix.grid({
data:[
{ id:1,name:"The Shawshank Redemption",year:1994},
{ id:2,name:"The Godfather",year:1972}
]
});

Related sample:  Loading from an Inline Data Source

webix.grid({
url:"data/data.json"
});

Related sample:  DataGrid: Loading from Different File Types

The url property can be:

  • a string with the path to a file, a script or a service
webix.grid({
url:"data/customers"
});
  • a function to fetch and parse data into a widget
webix.grid({
autoConfig:true,
url:function(){
return fetch("some/path").then(response => response.json());
}
});