Using pure jQuery, I have a ComboBox that retrieves values from a webservice. How do I set the initial value such that it shows the name, and not the ID?
For example I have 1 million customers in my database, but on page load I want to show that customer #17, Bob's Burgers, is currently selected.
I'd like the combobox to initially show [Bob's Burgers] and have a value of 17.
Thanks in advance!
For example I have 1 million customers in my database, but on page load I want to show that customer #17, Bob's Burgers, is currently selected.
I'd like the combobox to initially show [Bob's Burgers] and have a value of 17.
Thanks in advance!
var
a = $(item).kendoComboBox({
placeholder:
"Select"
,
dataTextField:
"Name"
,
dataValueField:
"id"
,
filter:
"contains"
,
autoBind:
false
,
width:
"400px"
,
dataSource: {
type:
"json"
,
serverFiltering:
true
,
transport: {
read: {
type:
'POST'
,
url:
"../WebServices/DropdownWebService.asmx/SearchCompanies"
,
item: item,
contentType:
'application/json; charset=utf-8'
,
datatype:
'json'
,
data:
function
(result) {
return
{
ssid: globalValues.ssid,
query: result.filter?result.filter.filters[0]?result.filter.filters[0].value:
""
:
""
,
type: $(
this
.item).attr(
'data-type'
)
}
}
},
parameterMap:
function
(options) {
return
JSON.stringify(options);
}
},
schema: {
data:
"d"
}
// schema
},
template:
'<span class="col-first"><span class="type-box-#: data.EntityType#">#: data.Name#</span></span>'
});