Skip to content

Loading from XML, CSV, JSArray

When loading a non-JSON data, you need to specify the datatype property in config, or pass the name of the expected data type as the second parameter of the parse/load method.

You will also need to use column data mapping to show the correct data in each column.

Loading from CSV
webix.grid({
columns:[
{ map:"#data1#", header:"First column" },
{ map:"#data2#", header:"Second column" }
],
datatype:"csv",
url:"data/data.csv"
});

Related sample:  Loading from an External Data File

With XML, if the tags in data are the same as column IDs, there is no need for you to use mapping:

webix.grid({
columns:[
{ id:"name", header:"Will use value from sub-tag 'name'" }
{ id:"details", header:"Will use value from the 'details' attribute or sub-tag" }
],
datatype:"xml",
url:"data/data.xml"
});

Otherwise, also use mapping:

Loading from XML
webix.grid({
columns:[
{ map:"#cells[0]#", header:"Will use value from first cell sub-tag" }
{ map:"#details#", header:"Will use value from details attribute or sub-tag" }
],
datatype:"xml",
url:"data/data.xml"
});

Related sample:  Loading from an External Data File

For more details, check Data Mapping