AutoFill with Editor doesn't work
AutoFill with Editor doesn't work
M_Mode
Posts: 4Questions: 0Answers: 0
Hello,
I use autofill with the editor, but on changes with autofill, the server side script will not be called.
Info: I use the newest nightly from all extensions and from the editor i use the trial version.
Here is my code:
var editor = new $.fn.dataTable.Editor( {
"ajax" : "./ajax/script.php",
"table": "#datatable_articles",
"idSrc": 'articleID',
"fields": [
//... my fields
]
} );
var otable = $('#datatable_articles').DataTable({
// ... settings
"autoFill": {
editor: editor
},
"bProcessing": false,
"sAjaxSource": urlAction,
// ... more settings
});
This discussion has been closed.
Replies
Can you give me a link to a test page showing the issue please? It appears to work okay in this example.
Allan
Hello, i have found the bug.
If you use "idSrc" in the editor and your data hasen't the "DT_RowId" in the array, then the editor doesn't call the ajax (create, update, delete) script.
If "DT_RowId" in the data available, then you can use the "idSrc" (even it makes no sense) and the update works. I think is is a bug in the autoFill script or in the editor.
Could you try setting the
rowId
property in DataTables to match whatever your EditoridSrc
option is please?If you could show me a sample of your data and the full initialisation you are using I'll try to recreate the issue.
To be honest, I would be surprised if the
idSrc
had an effect on AutoFill since it uses nodes to tell Editor what rows / cells to edit, rather than id values.Thanks,
Allan
Ah okay,
if i set the rowId, it works without problems.
This is the configuration, which make problems (only the important things.):
Editor:
Datatable:
- no rowId
Array from the PHP:
That's fantastic - thanks. Good to hear you've got it working with the
rowId
option. I'll take a look into this and try to determine what is going wrong without it - it shouldn't be required I don't think.Allan
I encountered this as well. The docs do describe the difference between idSrc and rowId but I latched onto idSrc and didn't see rowId until the code's use of id() pointed me to it. It's a subtle difference between the two. I didn't see this posting until after I had dug into the code. So, for what it's worth, AutoFill requires rowId at "var id = dt.row( cell.index.row ).id();" near the bottom of AutoFill's _editor function