jspreadsheet / jspreadsheet/ce
Inserting a column of type "color" gives an error
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.2k
- Forks
- 890
- PR merge metrics
- No merged PRs in 30d
Description
Hi there,
I want to append a "color" column to my table. It works but when I click twice on a cell to enter in edit mode, some errors appears browser's console.
Here is the code:
// Init table 1x1
const table = jspreadsheet(document.getElementById('spreadsheet'), {
minDimensions: [1, 1],
});
// Colors column data
const data = ['#777000','#777000','#777000','#777000','#777000'];
const colOptions = { type: 'color', render:'square', width: '100px' };
// Add empty rows (4 empty rows for this example)
const tc = table.getConfig();
const rowsNb = tc.data.length;
const rowsToAdd = colsData.length - rowsNb;
table.insertRow(rowsToAdd);
// Insert column
const pos = tc.columns.length;
table.insertColumn(data, pos, false, colOptions);
// Now we have a 2-col table. Remove 1st column (empty one) and keep only colors
table.deleteColumn(0, 1);
Note that I need to insert this column dynamically, I can't use "columns" and "data" fields at the table initialisation step.
So at a first look it works:

Let's double click on the 1st cell:
- Color editing widget doesn't show up

- An error
TypeError: undefined is not an object (evaluating 'obj.options.columns[x].options.value = obj.options.data[y][x]')appears in the console

Is it a known bug or am I doing something wrong?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided dynamic insertColumn reproduction and inspect the color-column editing path triggered by double-clicking the first cell. Done means the color editing widget appears and the browser console no longer reports the undefined columns/options error.
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
- 35/100