I have a kendo grid setup with its own datasource and within the databound event I am binding a dropdownlist to its own datasource.
The grid binds ok and the dropdown is populate ok however when I look in the network console I am seeing that the datasource is calling my service everytime a dropdown list is added.
How can I set this up to only call the service the single time as I don't want to be making extra calls to my api
The grid binds ok and the dropdown is populate ok however when I look in the network console I am seeing that the datasource is calling my service everytime a dropdown list is added.
How can I set this up to only call the service the single time as I don't want to be making extra calls to my api
var
dataSource =
new
kendo.data.DataSource({
transport: {
read: {
url:
"/API/store/get"
,
dataType:
"json"
,
data:
function
() {
return
{
businessId: $(
"#BusinessId"
).val()
};
}
}
}
});
var
data =
new
kendo.data.DataSource({
transport: {
read: {
url:
"getoutlets"
,
dataType:
"json"
,
data:
function
() {
return
{
businessId: $(
"#BusinessId"
).val()
};
}
}
}
});
$(document).ready(
function
() {
$(
"#outlets"
).kendoGrid({
sortable:
true
,
dataSource: data,
dataBound:
function
(e) {
$(
".dropdown"
).kendoDropDownList({
dataTextField:
"StoreName"
,
dataValueField:
"StoreId"
,
dataSource: dataSource
});
console.log(e);
},
columns: [
{
field:
"name"
,
title:
"Name (Supplier)"
},
{
title:
"Name"
,
template:
"<input class='dropdown' id\='#=id #' value\='#=MappedStoreId #'></input>"
}
,
{
title:
""
,
template:
'<a href="\\#" class="green-button small" data-id\="#=id #">Update</a>'
,
width:
"110px"
}
]
// rowTemplate: kendo.template($("#rowTemplate").html())
});