[英]Kendo Combo Box Scroll: automatically call function
I am new to Kendo and creating a project using it. 我是剑道新手,正在使用它创建一个项目。 I have encountered a very unique kind of problem.
我遇到了一种非常独特的问题。 I am using select options in kendoCombox.
我在kendoCombox中使用选择选项。 What I am doing is that I am just updating the select box value on click of the edit button.
我正在做的是,我只是在单击编辑按钮时更新选择框值。 The value is updated successfully but when I scroll, it automatically calls the function where I get all values.
该值已成功更新,但是当我滚动时,它会自动调用获取所有值的函数。 Here is my code:
这是我的代码:
I am updating the value using this: 我正在使用此更新值:
$("#rackModelName").data("kendoComboBox").value(deviceModelName);
<select class="span12" onchange="rackChange()" id="rackModelName" name="rackModelName"
tabindex="6">
</select>
The below function automatically calls on scroll change: 以下功能会自动调用滚动更改:
function getRackFun(libraryDeviceId,dataCenterId,type){
console.log("calling");
if(libraryDeviceId && dataCenterId){
$.ajax({
type : "GET",
dataType : "json",
url : "${getRacksByLocationId}&libraryDeviceId=" + libraryDeviceId+"&dataCenterId=" +dataCenterId,
success : function(result) {
if(result.length>0){
var jsonObject = jQuery.parseJSON(JSON.stringify(result));
$("#rackModelName").data("kendoComboBox").setDataSource(jsonObject);
}else{
if(type!="edit"){
$("#rackModelName").data("kendoComboBox").value("");
$("#rackModelName").val("");
$("#rackModelName").data("kendoComboBox").setDataSource([]);
$("#rackStartUnit").empty();
$("#rackStartUnit").append($('<option>',{
value : '',
text : '<liferay-ui:message key="inventory.please_select"></liferay-ui:message>'
}));
$("#rackEndUnit").val('');
}
}
}
});
}else{
$("#rackModelName").data("kendoComboBox").value("");
}
}
change the way you initialize the combobox to 更改将组合框初始化为的方式
$("#rackModelName").kendoComboBox({
...
change: rackChange, //your change function name
...
});
$("#rackModelName").data("kendoComboBox").value(deviceModelName);
remove the on change from the html element 从html元素中删除on更改
To know more about events trigger check this https://demos.telerik.com/kendo-ui/combobox/events 要了解有关事件触发的更多信息,请检查此https://demos.telerik.com/kendo-ui/combobox/events
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.