jspreadsheet / jspreadsheet/ce

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

Open
#1,794 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
7.2k
Forks
890
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the setData entry point and the onload and onafterchanges callbacks, then compare their behavior with the documentation and with undo. Done means the documented callback behavior matches actual setData and undo behavior, with the reported spreadsheet refresh and resize use case covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.