Prepare source data for the Data Grid widget
- Last UpdatedJul 12, 2024
- 1 minute read
Source data displayed by the Data Grid widget can be formatted as CSV or JSON strings.
For source data formatted as a CSV string, the first line is considered as the header (column names). Subsequent lines are data. Generally for CSV formatted files, a comma is used as the separator between data elements in a row.
Direction,Year,Date,Weekday,Country,Commodity,Transport_Mode,Measure,Value,Cumulative
Exports,2015,01/01/2015,Thursday,All,All,All,$,104000000,104000000
Exports,2015,02/01/2015,Friday,All,All,All,$,96000000,200000000
Exports,2015,03/01/2015,Saturday,All,All,All,$,61000000,262000000
Exports,2015,04/01/2015,Sunday,All,All,All,$,74000000,336000000
For source data formatted as a JSON string,the data is parsed as an array of dictionary objects. The first item in the array is considered as the header (column names) of the Data Grid widget.
As part of parsing the data, the data type of the fields is also resolved. The resolved data types can be any of the following:
-
String
-
Number
-
Date
The parser identifies a string as a Date only if the value is either in the ISO Date (e.g. 2021-08-26T07:44:36.079Z) or in the format specified by the DateFieldFormat property of the widget.