When the multiselection
property of Combo control isn't specified or is set to false, you can set the value of ID as a string, number or array:
const form = new dhx.Form("form_container", {
rows: [
{
name: "combo",
type: "combo",
multiselection: false,
data: [
{ value: "value: 1", id: "id:1" },
{ value: "value: 2", id: "id:2" },
{ value: "value: 3", id: 3 },
{ value: "value: 4", id: 4 },
{ value: "value: 5", id: 5 },
]
},
]
});
form.getItem("combo").setValue(4);
If multiselection
is enabled, you need to pass to the setValue
method an array with string/number values of IDs:
const form = new dhx.Form("form_container", {
rows: [
{
name: "combo",
type: "combo",
multiselection: true,
data: [
{ value: "value: 1", id: "id:1" },
{ value: "value: 2", id: "id:2" },
{ value: "value: 3", id: 3 },
{ value: "value: 4", id: 4 },
{ value: "value: 5", id: 5 },
]
},
]
});
form.getItem("combo").setValue(["id:1", 4]);
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4