Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Docs say setData triggers the onload event but it doesn't actually seem to #1794

@methnen

Description

@methnen

Titles explains it. Basically I've got a sheet with a couple of event functions attached to handle refreshing a chart and resizing the column widths.

Jspreadsheet CE is initially called like this:

const spreadsheet = jspreadsheet( spreadsheet_div, {
	worksheets: [{
		data: data,
		allowComments: false,
		minDimensions: [37, 17]
	}],
	onload: function(spreadsheet) {
		// Run an auto width function to make the column widths match content
		const worksheet = spreadsheet.worksheets[spreadsheet.getWorksheetActive()];
		autoWidth(worksheet);
	},
	onafterchanges: function(worksheet, records) {
		// Run an auto width function to make the column widths match content
		autoWidth(worksheet, records);

		// Update chart on spreadsheet changes
		refreshChart();
	}
});

Then when needed I run a setData call like this:

spreadsheet.setData( response.data );

The docs say that onload will run when setData is called to change/set the data in the sheet but this does not seem to actually happen. You'd potentially think that onafterchanges might run too since cells are changing, but it doesn't run either.

It's also worth noting that none of this fires after undo either, which seems counterintuitive in particular with onafterchanges.

This is with the latest (as I write this) v5 version of Jspreadsheet CE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions