Old IndexedDB forum example produces Datatables warning No. 4
Old IndexedDB forum example produces Datatables warning No. 4
Dear all,
using Alan's old example code from
http://datatables.net/forums/discussion/12240/sql-integration-for-offline-database
to try to understand IndexDB interaction the execution stops with :"DataTables warning: table id=example - Requested unknown parameter 'item' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4"
HTML is:
<table class="display" id="example" width="100%">
<thead>
<tr>
<th>item</th>
<th>status</th>
</tr>
</thead>
</table>
table definition is straight out of the example with some adjustments to current
table = $('#example').dataTable( {
dom: "Bfrtip",
columns: [
{ "data": "item" },
{ "data": "status" }
],
buttons: [
{ extend: "create", "editor": editor },
{ extend: "edit", "editor": editor },
{ extend: "remove", "editor": editor }
]
} );
I don't see any difficulties and would appreciate some help. The table shows that the IndexDB has three entries, which is correct - "Showing 1 to 3 of 3 entries". The Editor adds correctly new items to the IndexDB. But the table does not show the result.
Thank you
Answers
Did you follow the troubleshooting steps at the link provided in the error?
Sounds like your JSON response does not match your Datatable config. See the Data doc for more info.
Kevin
Dear Kevin,
Thank you for your response.
Indeed, the JSON is wrong. The way it is constructed in the legacy code it does not work. The fields definition (only the first field definition is shown, but all field definitions must be adjusted)
must be changed to
After making this change the table does not produce the error and shows all records.
However, this introduces a whole set of other issues, like the edit does not perform an edit, but adds a new record instead to the IndexedDB.
I guess I have to dig deeper.