Inline editing submit parameters - upgrading from 1.4

Prior to Editor 1.5, Editor would submit the full form data when inline (inline()) or bubble (bubble()) editing a cell. Typically only the value that has been edited in these modes will actually change and needs to be written to the database, so submitting the full form is wasteful of resources.

Having said that, it can at times be useful to submit the full form, and Editor 1.5 has an option for this using the form-options object (please note that this requires Editor 1.5.1 or newer).

What has changed?

When submitting data to the server, Editor now has three options defined by the submit option of the form-options object:

  • all - The values of all fields being edited will be submitted
  • changed - Only the values of the fields that have been changed will be submitted
  • allIfChanged - The values of all fields being edited will be submitted, but only if there is a changed value.

By default, for inline and bubble editing the value of this option is changed - i.e. only the field value that has been edited will be submitted. If no change in value is found, it will not be submitted and no Ajax request will occur if no fields have changes values.

Why the change?

This is to stop redundant writing of data to a database - if a value has not changed, writing the same value to the database is wasteful of resources.

What do I need to do?

If you wish to restore the 1.4- style of submitting all parameters on submit, there are two options available:

1) Use the form-options parameter for the inline() / bubble() methods:

$('#myTable').on( 'click', 'tbody tr', function () {
    editor.inline( this, {
        submit: 'allIfChanged'
    } );
} );

2) Use the formOptions.inline option to set a default for the form options:

var editor = new $.fn.Editor( {
    ajax:  "php/staff",
    table: "#myTable",
    formOptions: {
        inline: {
            submit: 'allIfChanged'
        }
    }
} );

Where can I read more?

If you have any questions about the change, please ask in the forums.