Unable to programmatically set value when using editor with submit mode = changed

Unable to programmatically set value when using editor with submit mode = changed

perrotinperrotin Posts: 39Questions: 9Answers: 1
edited March 2017 in Editor

Hello Allan,

I'm working with editor, server side, without table (in standalone mode) and with submit option = 'changed'.
When I try to use the set() method programmatically on a field, it sometimes doesn't trigger any ajax POST.

editor.edit('row_12',false);
editor.set('fieldName','value');
editor.submit();

See the use case I previously posted there : https://datatables.net/forums/discussion/37187 .

In this topic you explained to me that it was the expected behavior when using "changed" submit option, and suggested that I used "all' instead.

The problem is that I've got thousand fields on my standalone page, and I don't want all data transmitted when updating a single field ( firstly because that would result in user erasing data modified by other users, and secondly because it allows me to log server side which field has been updated by whom).

This issue with the set( fieldNames , value ) method is really annoying, and I'm constantly looking for alternatives but none of them are satisfying.

Wouldn't it be possible to add a parameter to the set method, (or maybe to the submit method) to allow the edit request to be sent when a field has been set programmatically. Is there another alternative that I haven't thought about.

Thank you for your time .

Julian

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,726Questions: 1Answers: 10,109 Site admin

    Hi Julian,

    I've actually been doing some work that I think is related to the issue you are seeing. I've just sent you a PM with an updated version of Editor to try out.

    Regards,
    Allan

  • torlancotorlanco Posts: 3Questions: 1Answers: 0

    Hey Allan, Im having the same issue. I would like to only send the edited field and not the row data. Ive noticed that in non-programmatical inline editing it only sends the field.

  • allanallan Posts: 61,726Questions: 1Answers: 10,109 Site admin
    Answer ✓

    The submit option of the form-options controls what is submitted to the server. For a standard edit its default is all, for inline editing it is changed. You need to change the default for the main editing if you want it to submit only changed values - see the formOptions.main options for full details.

    Allan

This discussion has been closed.