Can't add inline editing
Can't add inline editing
Now that I figured out the generator and adding where clause, I decided to use the simple html generated page to test adding in a simple inline editing based on the examples; however, when I put in the code for the simple inline editing, I just keep getting the reinitialising error: DataTables warning: table id=membersalelist - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3
I understand what it means, I do not understand how to fix it so I can actually test this piece and if I can't produce a working test, then I am not going to add it to the site itself. I'm just very confused at this point as it seemed simple enough to follow the example but apparently not.
Replies
Its hard to say what the problem is without seeing it. Just guessing you have
$('#example').DataTable()
in your code to get an instance of the Datatable API which is executing before you initialize the Datatable. Maybe you can post your JS code so we can see if there is anything obvious. Otherwise will will need a link to your page or a test case showing the issue.https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
You can start with this Editor base test case:
http://live.datatables.net/guwafemu/178/edit
Kevin
I read too quickly.. I can paste the code. I literally copied / pasted from example editing for my specific information. So what bothers me, if I copy from example and get the error why isn't the example throwing one lol
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
The above code looks ok. Is there a Datatable initialization in
js/table.membersalelist.js
?Kevin
/*
* Editor client script for DB table membersalelist
* Created by http://editor.datatables.net/generator
*/
(function($){
$(document).ready(function() {
var editor = new $.fn.dataTable.Editor( {
ajax: 'php/table.membersalelist.php',
table: '#membersalelist',
fields: [
{
"label": "StatusID:",
"name": "StatusID"
},
{
"label": "AAA_ID:",
"name": "AAA_ID"
},
{
"label": "LastName:",
"name": "LastName"
},
{
"label": "DaysNeeded:",
"name": "DaysNeeded"
},
{
"label": "MinimumDesired:",
"name": "MinimumDesired"
},
{
"label": "ContactEmail:",
"name": "ContactEmail"
},
{
"label": "Active:",
"name": "Active"
},
{
"label": "Confirmed:",
"name": "Confirmed"
}
]
} );
} );
}(jQuery));
Thats the problem. You have two datatable initialization statements where you can only have one. Looks like the two are essentially the same except the code in your second post uses the select checkbox. In addition you have two sets of Editor initialization. Only the last one executed will be used. You can decide which to use but the only code you need to add to use inline editing is this to enable it:
Kevin
thank you @kthorngren I would have NEVER figured that out lol
new problems now, After your suggestion and THEN also the example from https://editor.datatables.net/examples/inline-editing/serverSide.html
just throws All of this:
after searching here for some resolution, all I found was possibly table data columns different than table headers; however, all mine are equal at 8 columns and line up so I am stumped again.
Can you give me a link to your page so I can debug it? If that isn't possible, can you show me your latest Javascript and HTML.
Thanks,
Allan
@allan sure thing, here is my latest code
javascript
html
You've got 8 columns defined in your HTML and 9 in the
columns
array for the Javascript. That is what is causing the error. Perhaps add<th></th>
as the first column in the header.Allan