Editor inline with HTML-table as src.
Editor inline with HTML-table as src.
I'm installing datatables with regular HTML-tables as data source. That is working great. But I would like to also add inline editing to the table with the editor plugin.
The problem I have is that I have many columns in the table. And I would really like to init the Datatable without having to defining each column in javascript to make it editable. Is it possible to do something like this:
Init of editor:
editor = new $.fn.dataTable.Editor( {
ajax: "modEcs/ajax/ecs.php?a=inline",
table: "#artikkelTable",
fields: [ {
label: "Bredde",
name: "ECS_Width"
}, {
label: "Lengde",
name: "ECS_Length"
}
]
} );
And then in the HTML-table set data-something="ECS_Width" to map the correct field to the editor?
This question has an accepted answers - jump to answer
Answers
Currently no - sorry. Each editable field does need to be defined - consider in your example above it needs the
fields.name
column to be unique for each field so the server can know which field has been changed for example.Having said that, it would be quite possible using the
add()
method to programmatically add them if that information is available in the DOM, via Ajax or from somewhere else.Allan
Ok, thanks for the answer. Since this was so diffcult to do, I decided to just drop using the Editor and go with content="editable" on the cells. I seems to be doing the same only much easier.