Editor bulk update

Editor bulk update

klymov.inekonklymov.inekon Posts: 23Questions: 4Answers: 0

Hello, this is not an error, but suggestion for improvement.
I've met a problem, that I can't edit more than 4096 fields at one time (limited in .net by

services.Configure<FormOptions>(options =>
{
    options.ValueCountLimit = 4096; }) 

).
Resolving this I've create this script that create resubmit of chuncked values (multiset not work for me). This action for button that confirm modify in editor modal.

name: "editYes",
action: function (e, json, data, action) {
    if (processing) return;
    const chunkSize = Math.floor(maxFormSizeLimit / editor.fields().length);
    var chunkCounter = 0;
    var toUpdateValuesChunk = toUpdateValues.slice(chunkCounter, chunkCounter + chunkSize);
    var toUpdateRowIdsChunk = toUpdateRowIds.slice(chunkCounter, chunkCounter + chunkSize);
    editor.on('preClose', function (e) {
        return !processing;
    });
    editor.on('preSubmit', function (e, data, action) {
 //field.multiSet(toUpdateRowIds[j], value) not work if  table page not contain element
        delete data.data.keyless;
        processing = processing;
        chunkCounter = chunkCounter + chunkSize;
         
        for (var i = 0; i < toUpdateValuesChunk.length; i++) {
            data.data[toUpdateRowIdsChunk[i]] = toUpdateValuesChunk[i];
        }
    });
    editor.on("postSubmit", function (e, json, data, action, xhr) {
        if (chunkCounter >= toUpdateValues.length) {
            editor.off('postSubmit').off('preSubmit').off('preClose');
            processing = false;
            if (toCreate.length > 0) {
                createRecords(editorCreate);
            }
            else {

                editor.close()
                resetTable();
            }
        }
        else {
            toUpdateValuesChunk = toUpdateValues.slice(chunkCounter, chunkCounter + chunkSize);
            toUpdateRowIdsChunk = toUpdateRowIds.slice(chunkCounter, chunkCounter + chunkSize);
            //@ts-ignore
            editor.s.processing = false;
            editor.submit(null, null, null, false);
        }
    })
    editor.submit(null, null, null, false);
}

I might to do same thing for bulk delete and create.

Replies

  • allanallan Posts: 64,677Questions: 1Answers: 10,696 Site admin

    Thank you for sharing that! My understanding is that it is possible to increase the limit in .NET so that might be an option (up to a point) as well.

    Allan

Sign In or Register to comment.