Editor example Inline editing

This example is basically the same as the simple standalone editing example but in this case the inline() method is used for editing the fields, rather than the edit() primary method for editing the whole form.

Standalone forms can befit from inline editing in exactly the same way as DataTables based editing forms and with all of the same features. As with DataTables, this can be very beneficial for speed of editing.

Please note that this example doesn't actually save to a database at the server. A refresh will result in the original values being restored.

State:
Enabled
Server IP:
153.63.213.41
Poll period (seconds):
60
Protocol:
TCP

The Javascript shown below is used to initialise the table shown in this example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var editor; // use a global for the submit and return data rendering in the examples
 
$(document).ready(function() {
    editor = new $.fn.dataTable.Editor( {
        ajax: "../php/standalone.php",
        fields: [ {
                label: "Status:",
                name:  "enable",
                type:  'radio',
                options: [
                    { label: 'Enabled',  value: 'Enabled' },
                    { label: 'Disabled', value: 'Disabled' }
                ]
            }, {
                label: "Server IP address:",
                name:  "server-ip"
            }, {
                label:     "Polling period:",
                name:      "poll-period"
            }, {
                name: "protocol", // `label` since `data-editor-label` is defined for this field
                type: "select",
                options: [
                    { label: 'TCP', value: 'TCP' },
                    { label: 'UDP', value: 'UDP' }
                ]
            }
        ]
    } );
 
    $('[data-editor-field]').on( 'click', function (e) {
        editor.inline( this, {
            buttons: '_basic'
        } );
    } );
} );

In addition to the above code, the following Javascript library files are loaded for use in this example:

Editor submits and retrieves information by Ajax requests. The two blocks below show the data that Editor submits and receives, to and from the server. This is updated live as you interact with Editor so you can see what is submitted.

Submitted data:

The following shows the data that has been submitted to the server when a request is made to add, edit or delete data from the table.

1
// No data yet submitted

Server response:

The following shows the data that has been returned by the server in response to the data submitted on the left and is then acted upon.

1
// No data yet received