Editor example Bubble editing

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

Standalone forms can benefit from bubble 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:
60 seconds
Protocol:
TCP

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

var editor; // use a global for the submit and return data rendering in the examples $(document).ready(function() { editor = new $.fn.dataTable.Editor( { ajax: "../../controllers/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:", fieldInfo: "Input value is in seconds", 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.bubble( this ); } ); } );

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

The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:

This example uses a little bit of additional CSS beyond what is loaded from the library files (below), in order to correctly display the table. The additional CSS used is shown below:

dt { margin-top: 1em; } dt:first-child { margin-top: 0; } dd { width: 25% } *[data-editor-field] { border: 1px dashed #ccc; padding: 0.5em; margin: 0.5em; } *[data-editor-field]:hover { background: #f3f3f3; border: 1px dashed #333; }

The following CSS library files are loaded for use in this example to provide the styling of the table:

This table loads data by Ajax. The latest data that has been loaded is shown below. This data will update automatically as any additional data is loaded.

The script used to perform the server-side processing for this table is shown below. Please note that this is just an example script using PHP. Server-side processing scripts can be written in any language, using the protocol described in the DataTables documentation.