Editor bulk update
Editor bulk update
 klymov.inekon            
            
                Posts: 35Questions: 9Answers: 0
klymov.inekon            
            
                Posts: 35Questions: 9Answers: 0            
            
            
                            
                                  in General             
        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
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