Search code examples
javascripthandsontable

Is there a row limit for copying data into handsontable ?


When copying sevreal thousand rows into handsontable from excel it throws

Uncaught Error: Security brake: Too much TRs. 
Please define height for your table, which will enforce scrollbars. 

I set the height in the constructor

var options = { 
 height       : 340, 
 minSpareRows : 1,
 minSpareCols : 1,  
 colHeaders   : false,
 contextMenu  : true,
 columnSorting: true,
 ...
} 

Same error - Is there any way to overcome this ?

Second, How can i catch this error ?


Solution

  • I just ran a quick test with handsontable, using 14 columns, I was able to load about 1200 rows. This is indicative of a cell number of about 16 000.

    You can try lazy or delayed loading of data by adding a callback that is triggered on paste by handsontable.

    Otherwise you can use the callback on paste to check the length of the data on the clipboard first and displaying an error if it is too big.

    var clipText = window.clipboardData.getData('Text');
    

    This allows you to access text from the clipboard in javascript.