jspreadsheet / pro

Jspreadsheet Pro | The javascript spreadsheet
https://jspreadsheet.com/
15 stars 1 forks source link

The data option has been modified #318

Closed Ily1606 closed 6 months ago

Ily1606 commented 6 months ago

When using

 <script src="https://jspreadsheet.com/v10/jspreadsheet.js"></script>

The options.data has been modified when jspreadsheet rendering.

image

hodeware commented 6 months ago

When using an array of object you need to give columns the property name.

jspreadsheet(document.getElementById('spreadsheet'), {
    worksheets: [{
        // Data pass as a reference
        data: data,
        columns: [{
            // Path to the data property for this column
            name: 'name',
            title: 'Full name',
            type: 'text',
            width: '200px',
        },
        {
            // Path to the data property for this column
            name: 'address.number',
            title: 'Number',
            type: 'text',
            width: '200px',
        },
        {
            // Path to the data property for this column
            name: 'address.city',
            title: 'City',
            type: 'text',
            width: '300px',
        }]
    }]
});

Note that the name represent the adress of your object (nested addresses are accept as above)