jspreadsheet / pro

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

[Dropdown]: Dropdown Cell Type icon remains after Cell Type change #308

Closed jramirez-struc closed 10 months ago

jramirez-struc commented 11 months ago

Hello! First of all, I'd like to thank you for the continued support and answers to requests I made in the past.

I'd like to point out another behavior of when one sets a cell to have a type of dropdown. Here are some steps to reproduce:

We've developed a feature in which one can set the cell type of selected cells by adding a select option on the toolbar.

When saving the worksheet, the dropdown arrow dissappears. The problem is while editing the worksheet, this glitch can be confusing to the user.

Here's the code we've written for the toolbar select:

const cellType = {
    type: 'select',
    options: cellTypes,
    render: function (e) {
      return `<span>${e.charAt(0).toUpperCase() + e.slice(1)}</span>`
    },
    onchange: function (a, b, c, type) {
      if (worksheetInstance()) {
        const selected = worksheetInstance().getSelected() || []
        // Cycle through selected cells
        selected.map((item: { x: number; y: number }) => {
          const { x, y } = item
          worksheetInstance().updateProperty(x, y, { type })
        })
      }
    },
  }

Let me know if the issue is clear enough. Thanks in advance.

hodeware commented 11 months ago

There is a patch to be release tomorrow. It will include a fix to handle this case.