jspreadsheet / ce

Jspreadsheet is a lightweight vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with other spreadsheet software.
https://bossanova.uk/jspreadsheet/v4
MIT License
6.77k stars 828 forks source link

Copy & Paste Feature #1311

Closed danieljsc closed 3 years ago

danieljsc commented 3 years ago

Hi,

Don't know if this was already reported here or not, I tried to search for similar problems but could not find it. When pasting a "large" volume of rows, it is not responsive. It seems that the copy paste gets stuck as if something which is iterative is running in the backend and it takes a lot of time.

Any way you could please look at this?

Thanks!

sFerreiraDev commented 3 years ago

Hi! I just want to add that we also have this issue. Copying paste large volume of rows (3K + with 9 columns for us) will indeed freeze the window for a short amount of time.

Here's some context (not sure how helpful it can be): jexcel: 4.5.2 ubuntu 20.04 AMD Ryzen 9350X and 32GB RAM

Btw great work on this library!

danieljsc commented 3 years ago

@sFerreiraDev indeed I was also trying to copy roughly the same amount of data (5k rows and 7 columns) and it freezes while pasting into the component. As far as I could check the past is iterative and that is probable the cause.

@Guillaume-Bo can you pls confirm? Is there something which could be done in order to improve paste performance?

GBonnaire commented 3 years ago

Hi @danieljsc and @sFerreiraDev

I have try with 2k rows. Jexcel Pro => 15 sec Jexcel CE => more 1 min.

JExcel pro it's better if you want paste lot of rows.

However, i can share an other method for past lot of rows. It's not better solution, but this solution can paste more quickly rows. For exemple : with 4k rows, in Jexcel CE, i have paste in 2sec.

var Table1 = jexcel(document.getElementById('spreadsheet'), {
        onevent: function (event) {
            if(event == "onbeforepaste") {
                var x = arguments[3];
                var y = arguments[4];
               // You can here add others test for just paste like this if it's lot of rows
                if(y == 0) { // Y should be 0, for insert at start row
                    var el = arguments[1];
                    var obj = el.jexcel;
                    // Split new line
                    var data = obj.parseCSV(arguments[2], "\t");

                    // Insert data
                    obj.options.data.splice(x, 0, ...data);

                    // Refresh table
                    obj.refresh();

                    return false; // It's important for stop paste on JExcel (default behavior)
                }
            }
        },
       // It's better with this options (optional)
        tableOverflow:true,
        lazyLoading:true,
}

With this method, you can't resize dimensions of Jexcel (you should have a good dimension before).

Good luck 😊

hodeware commented 3 years ago

In the new Engine 8, we paste 1 million rows in 2 seconds. Should be released in 4-6 weeks.

Alex-Monahan commented 3 years ago

Will that type of speed also be coming to the Community Edition? Super excited about it!

danieljsc commented 3 years ago

@hodeware was about to ask the same question.

On Wed, 17 Feb 2021 at 20:05, Alex-Monahan notifications@github.com wrote:

Will that type of speed also be coming to the Community Edition? Super excited about it!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jspreadsheet/ce/issues/1311#issuecomment-780819722, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRDMCFZTNILTAQBCXXX4ZTS7QOSPANCNFSM4XI57BGA .

-- Daniel Castro http://pt.linkedin.com/pub/daniel-castro/17/7bb/a59

LanderBeeuwsaert commented 3 years ago

hehe, same question here.

GBonnaire commented 3 years ago

Wait and see 😁 😉

danieljsc commented 3 years ago

Sorry for asking this again. Any news?

Thanks for the support in advance @Guillaume-Bo :)

hodeware commented 3 years ago

Hi Daniel, How many rows are you pasting?

danieljsc commented 3 years ago

Hi @hodeware ,

We are trying to paste 5k rows and it is taking a lot, even js becomes unresposive with prompts from the browser asking if we want to wait for the process to finish it or kill the process.

hodeware commented 3 years ago

Are you using lazyLoading: true or pagination: true?

danieljsc commented 3 years ago

@hodeware only using lazyLoading

danieljsc commented 3 years ago

tableWidth: "100%", tableHeight: "100%", tableOverflow: true, lazyLoading: true, loadingSpin: true, allowComments: true, search: true, data: JSON.parse(response.data), columns: columns, style: style, onchange: changed, ondeleterow: changed, oninsertcolumn: changed, ondeletecolumn: changed, onmoverow: changed, onmovecolumn: changed, onresizerow: changed, onresizecolumn: changed, onsort: changed, onchangeheader: changed, onchangestyle: styleChanged, onchangemeta: changed,

danieljsc commented 3 years ago

`function changed() { var save = $('#saveForm'); if (save.attr('disabled')) { save.removeAttr('disabled'); }

        $('#submitBtn').attr('disabled', 'disabled');

        if (!hasChanged) {
            hasChanged = true;
        }
    }

    var styleChanged = function () {
        if (styleCheck > 0) {
            changed();
        }
        styleCheck++;
    }`

image

hodeware commented 3 years ago

@danieljsc if you sent us an email I am happy to send more updates. contact@jspreadsheet.com