Editor field: datatables without ajax
Editor field: datatables without ajax
dudi
Posts: 1Questions: 1Answers: 0
https://editor.datatables.net/examples/datatables/index.html
In the documentation i have the ajax option, but i have a nested json like this:
[{ first_name: '...', children: [{ name: '' , ...} ] } ]
const editor = new DataTable.Editor({
data:: '../php/join.php', <-- this is not what i need, i need to access the children field in the row
fields: [
{
label: 'First name:',
name: 'first_name'
},
{
label: 'Children:',
name: 'children',
type: 'datatable',
config: {
columns: [
{
title: 'Name',
data: 'name'
}
]
}
}
],
table: '#example'
});
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Answers
There isn't a
data
option for Editor. Line 2 of your code there won't do anything (plus there is a syntax error ).Do you mean you want to load the list of options from the data object for the row? If so, do you have a separate value for which items in the list are selected?
Or is it something more like this that you are working with? If so, you can use
field().update()
to modify the data in the DataTable field. Call that ininitEdit
- for example:Allan