I already have the dropdown list from backend how to place them in Editor label.I am using Java
I already have the dropdown list from backend how to place them in Editor label.I am using Java
Madhavi Bhimisetty
Posts: 11Questions: 1Answers: 0
I am using Java as a backend
While loading the page I am getting dropdown list like status (active,inactive)
I am using html with thymleaf and Javascript as UI.
While creating table editor how to place that status in field list.
Javascript Code :
editor = new $.fn.dataTable.Editor( {
ajax: {
url: extract_url('/rest/updateType'),
data: { "_csrf": CSRF_TOKEN,typeName : 'Zones'}
},
table: "#zones-search-results",
idSrc: 'zoneId',
fields: [ {
label: "ID :",
name: "zoneId",
type:"hidden"
}, {
label: "Name :",
name: "name"
}, {
label: "Description :",
name: "description"
},
{
label: "Status :",
name: "description",
type: "select",
}
]
} );
Replies
You can use a static options array like in here:
https://editor.datatables.net/reference/field/select
Or you can update the field with options later using update():
https://editor.datatables.net/reference/api/field().update()