質問

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 ?

役に立ちましたか?

解決

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.

他のヒント

Regarding your second question of displaying a scroller:

$("#myHandsontable").bind('paste', function () {
    $('#updateProgress').show();
});

Then in the constructor use the after change event:

$("#myHandsontable").handsontable({
    ...
    afterChange: function(changes, source) {
        if (source == "paste") {
            $('#UpdateProgress').hide();
        }
    }
});

Although you should try the latest version of handsontable, they really made a huge improvement in the time that it takes to paste data in the table.

I just had this issue, it is a bit misleading due to the wording of the error,

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

The error suggests that defining a height will force scroll bars, but in fact, I fixed it by defining a height that was small enough so scrollbars were forced on the table.

Hope my version makes more sense... Everything seems to work fine then.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top