Browser become unresponsive/browser freeze after pasting large data

Tags: #<Tag:0x00007efc65061a90>

We have an application which will large amount of data.When i trying to paste large data to grid browser become unresponsive with wait and kill popup from brower. do we have anything to solve this issue?
How to avoid multiple pasting of same data( When we are pasting data to grid it will take some time to complete at the same user my try multiple time).
Can’t we display any progress bar? (I tried with beforepaste and afterpaste hooks but i did not worked out for me).

please help us to solve these issues? and let me know if you need more information to understand

Hi @rohit.parwal

pasting many data can jam the browser. It all depends on your resources.

We do not have any built-in progress bar but there’s a preloader that one of our devs made some time ago http://jsbin.com/haheru/3/edit?html,output
Please notice that it is only a preloader logic - you would need to block it yourself when data is loaded.

When it comes to callbacks we do not have afterPaste callback yet, but you can use the afterChange callback to be sure when data got pasted. The afterChange hook’s second parameter will return CopyPaste.paste when user pasts data (one call for many changes/cells).

JS Bin on jsbin.com

I tried as discussed above but what happens when we try to paste the data some how it’s not blocking or unblocking page. Here we want block the page when user try to paste the data until pasting is completed with a message. please let me know if you need more information.

thanks,
shiva

Hi @rohit.parwal

When data is pasted you get an afterChange call. Until the data gets pasted you can use these settings to block pasting.

var isCtrl = false;
  instance.updateSettings({
    beforeKeyDown: function(e) {
      if (isCtrl && e.keyCode === 86) {
        console.log('Paste option blocked');
        e.stopImmediatePropagation();
      }

      if (e.keyCode === 17) {
        isCtrl = true;
      } else {
        isCtrl = false;
      }
    }
  })

demo: http://jsfiddle.net/bvydt1kn/

1 Like