Hi Aleksandra,
Please can you share how we can use populateFromArray method, I am using this syntax
hotInstance.populateFromArray(1, 1,[[1], [2], [1], [2], [1], [2]]);
to update from 2nd row’s 2nd column till the 2nd column of 7th row.
But I am getting some error by using this method, Please can you help out?
Error :- TypeError: changes[i][3].trim is not a function
preet.saxena:
populateFromArray(1, 1,[[1], [2], [1], [2], [1], [2]])
Hey @preet.saxena
I guess that it depends on your dataset and structure. Here Handsontable example - JSFiddle - Code Playground it works well.
Can you share a dmeo?
Thanks,
Its working after converting my input to string and error is not appearing.
Can I use populate from array with the readOnly column?
No, if the cell is marked as readOnly
you cannot change it.
Example Handsontable example - JSFiddle - Code Playground
If you wish to block user from editing the changes but want to get the populating you can turn off the editor
Handsontable example - JSFiddle - Code Playground
Thaks Aleksandra,
But the editor will allow the data to paste so What I am thinking about the solution for this is that we can just turn on the readonly property before populateFromArray and after the execution of its turn off the read-only property.
If you want to cancel pasting you can use the beforePaste
hook. Here’s a demo that cancel some changes https://handsontable.com/docs/7.0.2/Hooks.html#event:beforePaste