Sample Data

The sample data for most WireBootstrap theme projects is in a JSONs file located at \data\sampleData.json.

Below is one of the records in the sample data file.

 {
        "Product": "All-Purpose Bike Stand",
        "Promotion": "No Discount",
        "OrderYear": "2019",
        "OrderMonth": "2019-02",
        "Cost": 951.4560,
        "Sales": 2544.0000
 }

A local data source is created from the sample data file located in the same directory at sampleData.ts.

const sampleDataSource = new wire.data.DataSource("local", {
    Provider: { 
        Json: {url: "../../data/sampleData.json" } 
    },
  ...
});  

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.

const sampleDataSource = new wire.data.DataSource("local", {
    ...
    Model: new wire.data.DataModel({
        Fields: [
            { Entity: "SampleData", Name: "Sales", Format: "C0" },
            { Entity: "SampleData", Name: "Cost", Format: "C0" }
        ]
    })
});  

Last updated