[英]Disabling manual inputs for KendoUI elements
I am using few KendoUI elements like ComboBox, DatePicker etc. everything works fine but there is one major problem that these elements actually allow manual input. 我使用很少的KendoUI元素,如ComboBox,DatePicker等。一切正常,但有一个主要问题,这些元素实际上允许手动输入。
For eg in the comboBox I can type by clicking on it which activates a text box, which is really dangerous and spoils the purpose of using a <select>
type list elements, same is the case with date picker. 例如,在comboBox中,我可以通过单击它来激活文本框,这非常危险并且破坏了使用
<select>
类型列表元素的目的,日期选择器的情况也是如此。
So can you guide how can I disable these manual inputs and only restrict user to the select from the available options. 因此,您可以指导如何禁用这些手动输入,并仅限制用户从可用选项中进行选择。
<input id="date" value="@DateTime.Now.Date"/>
<select name="need" id="need">
<option value="1">High</option>
<option value="2">Normal</option>
<option value="3">Low</option>
</select>
<script type="text/javascript">
$("#date").kendoDatePicker();
$("#need").kendoComboBox();
</script>
Kindly Help. 请帮助。
to deny manual input you need the access to the input textbox inside the telerik template: 要拒绝手动输入,您需要访问telerik模板中的输入文本框:
var input = $(#"combobox").data("kendoComboBox").input;
input.attr("readonly", "readonly");
If you dont want users to type in text , use the DropDownList instead of the combobox. 如果您不希望用户键入文本,请使用DropDownList而不是组合框。 For date picker you can easily disable the input element which you are converting to date picker using jQuery.
对于日期选择器,您可以使用jQuery轻松禁用要转换为日期选择器的输入元素。
$(document).ready(function() {
// create DatePicker from input HTML element
var datepicker = $("#datepicker").kendoDatePicker();
$("#datepicker").prop('disabled', true);
});
如果case不是可编辑的组合框,则dropdownbox()以这种方式而不是combobox()。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.