Sample Data
The sample data for most WireBootstrap theme projects is in a JSONs file located at \data\sampleData.json.
Project Data Directory
Below is one of the records in the sample data file.
1
{
2
"Product": "All-Purpose Bike Stand",
3
"Promotion": "No Discount",
4
"OrderYear": "2019",
5
"OrderMonth": "2019-02",
6
"Cost": 951.4560,
7
"Sales": 2544.0000
8
}
Copied!
A local data source is created from the sample data file located in the same directory at sampleData.ts.
1
const sampleDataSource = new wire.data.DataSource("local", {
2
Provider: {
3
Json: {url: "../../data/sampleData.json" }
4
},
5
...
6
});
Copied!

Data Model

Adding a data model tells WireBootstrap about the sample data so its able to automatically add data attributes such asSample Data formatting and display labels to result sets on behalf of components.
1
const sampleDataSource = new wire.data.DataSource("local", {
2
...
3
Model: new wire.data.DataModel({
4
Fields: [
5
{ Entity: "SampleData", Name: "Sales", Format: "C0" },
6
{ Entity: "SampleData", Name: "Cost", Format: "C0" }
7
]
8
})
9
});
Copied!
Copy link
Contents
Data Model