csv

the parser for data of the CSV format.

object csv;

Example

$$('mylist').define("datatype", "csv");
$$('mylist').load("data.csv");
// it is the same as
$$('mylist').load("data.csv","csv");

Related samples

Details

The object contains methods and properties for correct processing CSV data. The default logic can be customized globally:

webix.DataDriver.csv.cell = "\t";
webix.DataDriver.csv.row = "|";

or, to use the altered delimiters locally, whithin one or several components, a custom datatype can be created:

webix.DataDriver.mycsv = webix.extend({
    row:"|",    
    cell:"-"
}, webix.DataDriver.csv);

and used:

var grid = webix.ui({
    view:"datatype",
    datatype:"mycsv",
    data:'1-The Shawshank Redemption|2-The Godfather'
});
 
//or for loading data in that format
$$('mylist').load("data.csv","mycsv");

Component data can be loaded during initialization with datasource specified by the data property:

var csv_data = '1,The Shawshank Redemption,1994,678790,9.2,1\n
                2,The Godfather,1972,511495,9.2,2';
 
webix.ui({
    view:"datatable",
    columns:[..],
    datatype:"csv",
    data:csv_data
});
See also
Back to top