how to choose value in select2
how to choose value in select2
qngw
Posts: 3Questions: 2Answers: 0
I initialze the select2 in my editor and I need to set the value of select2 when I click edit button.
The following is my code:
{
label: "Is Active:",
name: "IsActive",
type: "select2", // https://editor.datatables.net/plug-ins/field-type/editor.select2
ipOpts: { "False": false, "True": true},
}
When I open the editor dialog, I need to set the value of select2 according to the actual value.
I have tried to use editor.field(IsActive).val(rowData['IsActive']), which doesn't work for select2, but for normal input.
Is there anyone know how to set the select2 value dynamiclly.
Thanks.
Kevin
This discussion has been closed.
Answers
The problem has been solved.
I have to make the value to be string but not the real true or false.
please refer to the following code: