Error initializing CellsMeta

Tags: #<Tag:0x00007f8b24082dc8>

When I create Hot, specify: {startRows: 70, startCols: 13}.

The wrong number was obtained through getCellsMeta().

You can see that the column in the first row is wrong.

Hi @MaLaTang

I’ve tried to replicate it here https://jsfiddle.net/xmq2beLw/ but the last element is

n {row: 69, col: 12, visualRow: 69, visualCol: 12, prop: 12, …}

there is no index 70.

Can you share an example of your implementation?

I used 6.2.2 ce

thank you
I’ve found the problem with this extra column.
And found a new problem.
I initialize :readOnly:true,
Cells can still be edited

hot.updateSettings({
        contextMenu: false,
    });

In all of the code execution is completed, updateSettings, contextMenu: false, readOnly: true.

Can not close the right menu, is the cell read - only.

What did I do wrong?

Can you share the code via JSFiddle? ReadOnly should not change when you can updateSettings for another option. How do you set the readOnly - contextMenu, cells/columns method, setCellMeta?

I tested it, and it worked if I initialized the pass in contextMenu:false when I created the instance.

UpdateSettings ({contextMenu:false}) is not valid if done after the instance is finished。

https://jsfiddle.net/hr1gwpk0/

@aleksandra_budnik

Do you have time to help me

Do you have time to help me

Yes. I’m here.

However, I do not see any different in number of generated rows and columns if we enable nor disable the contextMenu.

The result is still
{row: 69, col: 12, visualRow: 69, visualCol: 12, prop: 12, …}

Do you get any other value? What device/system do you use?

beauty girl。
No, the problem with incorrect columns has been solved.

Now I have a new problem.

Through updateSettings ({contextMenu: false})

The right-click menu still exists.

Aaah OK :slight_smile:

The right-click menu still exists.

I get the menu but the browser menu (not the Handsontable’s). If you wish to disable browser context menu here’s a tutorial https://stackoverflow.com/questions/381795/how-to-disable-right-click-context-menu-in-javascript

@aleksandra_budnik
If you set the cell to read only separately,

Hot. GetCellMeta (.) readOnly = false;

Then update:

hot.updateSettings ({readOnly: true,});

This cell is still saved.

Is this on purpose?

if you want to change meta for a cell you should use
Hot.setCellMeta(row, col, 'readOnly', false)
instead. GetCellMeta is used to get, not set.

@aleksandra_budnik

Okay, but
hot.getCellMeta(0,0).readOnly=false;
because of the js reference
next,
updateSettings ({readOnly:true}) is not valid.

Is it because I did something wrong with cellMeta?

This

updateSettings ({readOnly:true})

will overwrite your

setCellMeta > readOnly as setCellMeta is being overwritten by

  • updateSettings
  • cells
  • columns

Can you describe the exact situation, example

  • I want cell 0,0 to be readOnly
  • I want all the result to be editable (readOnly false)

@aleksandra_budnik
There is no expected effect.
I use hot.getCellMeta.readOnly = false; cell editing.
I use hot.getCellMeta.readOnly = true; cell disable.

For example:
hot.getCellMeta (0,0).readOnly = false; cells can be edited.

Then continue to use

hot.updateSettings({readOnly:true});

row: 0, col: 0, cells can still be edited.

Is updateSettings unable to overwrite the current cell settings because hot.getcellmeta (0,0). readOnly = false is used?

Yes,

hot.updateSettings({
readOnly: true
})

overwrites

readOnly: false

@aleksandra_budnik
There is no coverage.

https://jsfiddle.net/dnbe904q/

You can check out this example.

The first cell, no overwrite

Thank you for sharing the additional information.
I misunderstood the expected behavior previously. My bad.

You are right. The getCellMeta, in this case, is changing the readOnly state. But, that is not officially supported and it works only cause you are making a reference to the object. I do not recommend to change any cell meta via getCellMeta method.

@aleksandra_budnik
Ok,

How do I make updateSettings({readOnly:true})

Valid for all cells.