Hi,
I have tried to create a test case but there is any issue adding the libs. If you can give me any clue about how to finish the test case I will: https://live.datatables.net/kaquqexa/3/
I have one field of type select2 (blend) with option: multiple and other (format) allowing only single values. When I load the first time the page and edit a row the modal editor is loaded without the selected values. However, if I edit a second time the values are loaded.
var editor = new DataTable.Editor({
ajax: {
create: '/save/${id}',
edit: '/update/',
remove: '/delete/',
idSrc: 'id'
},
fields: [
{
name: 'DT_RowId',
type: 'hidden',
},
{
label: 'Blend',
name: 'blend',
type: "select2",
separator: ":",
opts: {
"multiple": true,
"allowClear": true,
"separator": ":",
"placeholder": {
"id": "",
"text":"(Select blends)"
}
},
options: [
{ label: '', value: '' },
{ label: '9000 Extra', value: '9000'},
{ label: '9001 RA', value: '9001'},
{ label: '9001 Col', value: '9001'},
{ label: '900R Classic', value: '900R'}
]
},
{
label: 'Format',
name: 'format',
type: 'select2',
options: [
{ label: '', value: '' },
{ label: '0000 Auxiliary Materials', value: '0000' },
{ label: '0001 Lid 50g.', value: '0001' },
]
},
{
label: 'Reference',
name: 'reference',
type: 'datatable',
config: {
columns: [
{
title: 'Reference',
data: 'label'
}
]
},
options: [
{label:'', value:''},
{
label: '9022 sp.20 Kg',
value: '8020'
},
{
label: '22G0 spr.300Kg.',
value: '8023'
},
]
},
{
label: 'Quantity',
name: 'quantity'
},
{
label: 'Unit',
name: 'unit',
def: 'KG',
type: 'select',
options: [
{label: 'Caja', value: 'BOX'},
{label: 'Kilo', value: 'KG'},
]
},
{
label: 'Status',
name: 'status',
def: 'NO_ACTIVED',
type: 'select',
options: [
{label: 'Activo', value: 'ACTIVED'},
{label: 'No activo', value: 'NO_ACTIVED'},
]
},
{
label: 'quantity to reduce',
name: 'quantityToBeReduced',
},
],
table: '#items'
})
;
var table = new DataTable('#items', {
ajax: {
url: '/list/${id}'
},
columns: [
{ data: 'blends.description' },
{ data: 'formats.description' },
{ data: 'references.description' },
{ data: 'quantity' },
{ data: 'units.description' },
{ data: 'statuses.description' }
],
layout: {
topStart: {
buttons: [
{ extend: 'create', editor: editor },
{ extend: 'edit', editor: editor },
{ extend: 'remove', editor: editor }
]
}
},
select: true
});
Thank you very much.