Editor very slow for editing many rows

Editor very slow for editing many rows

timbcusicktimbcusick Posts: 21Questions: 6Answers: 0

When editing 500 rows after clicking save button it takes minutes before the post method even gets called, client side. This is 1.8.1. If I change to 1.6.1 the post method gets called almost immediately. Seems to be a bug, but not sure. Apologies, but when I try to run the Datatables debugger it just hangs trying to "Uploading data to the server...."

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    1.8.1 is doing a fair amount more computation to check for differences in values, but I'm really surprised that it would cause such an issue.

    Any chance you can give me a link to the page so I can profile it? Send me a PM by clicking my name above and then "Send message" if you don't want to make it public.

    Thanks,
    Allan

  • timbcusicktimbcusick Posts: 21Questions: 6Answers: 0

    thanks allan. I think I was able to get a debug. Can you see this? If you can get 500 rows of data and edit you should see what I'm seeing.

    https://debug.datatables.net/edulub

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    I've just loaded up one of my tables with 513 rows and used:

    editor.edit( $('#example').DataTable().rows().indexes() ).buttons('submit');
    

    To trigger editing on all rows. It takes 335mS for the data to be processed by Editor before submitting it to the server:

    You have more columns in your table (17 to my 6), but that wouldn't account for the difference between 335mS and minutes.

    I'm afraid I'd need to be able to profile your app to understand where the time is being taken up. You aren't doing any client-side validation or have any hooks on preSubmit or similar do you?

    Allan

  • timbcusicktimbcusick Posts: 21Questions: 6Answers: 0

    allan thanks for digging into this. We do have a little presubmit code, but from debugging it doesn't seem like that's where it's getting hung up. Here is that code. If I remove it, it doesn't seem to make a difference in performance.

     editor.on('preSubmit', function (e, o, action) {
                if (action !== 'remove') {
                    var quantity = editor.field('quantity');
                    var location = editor.field('location');
                    var contractDescription = editor.field('contractDescription');
                    // Only validate user input values - different values indicate that
                    // the end user has not entered a value
                    if (!quantity.isMultiValue()) {
                        if (!quantity.val()) {
                            quantity.error('Quantity required.');
                        }
                    }
                    if (!location.isMultiValue()) {
                        if (location.val().length >= 255) {
                            location.error('Location length must be less than 255 characters');
                        }
                    }
                    if (!contractDescription.isMultiValue()) {
                        if (contractDescription.val().length >= 4000) {
                            contractDescription.error('Contract Description length must be less than 4000 characters');
                        }
                    }
                    // If any error was reported, cancel the submission so it can be corrected
                    if (this.inError()) {
                        return false;
                    }
                }
            });
    

    I was hoping that debug that I shared would give you a better idea. Unfortunately our site is not private so I can't point you at a URL. It appears that 1.7.1 is where the change occurred. 1.7.0 appeared to work for me.

  • timbcusicktimbcusick Posts: 21Questions: 6Answers: 0

    allan,

    I just emailed you a profile of the submit event. I wasn't able to attach the file as it was too large. Hope that helps.

    Tim

This discussion has been closed.