kendo-ui - 剑道对话最大长度
问题描述
我正在尝试使用剑道对话框作为用户输入的基本提示。
这是我的代码(类似于Telerik 给出的说明):
return $("<div></div>").kendoPrompt({
title: "Enter Reason",
content: "Enter a reason for your action",
width: 400
}).data("kendoPrompt").open().result;
我需要在生成的文本框中设置最大输入长度(400 个字符)。任何人都可以帮忙吗?
解决方案
有一个解决方法,首先隐藏默认输入,然后在内容上添加剑道模板。Promise 将接收输入的数据。
像这样的东西:
<style>
.k-prompt-container .k-textbox {
display: none;
}
</style>
<button id="promptBtn" class="k-button">myprompt</button>
<script id="test" type="text/x-kendo-template">
<p>Please enter text, max 10 length</p>
<input class="k-textbox" maxlength="10"/>
</script>
$('#promptBtn').on('click', function () {
window.myPrompt().then(function (data) {
console.log(data);
}, function () {
console.log('cancel');
})
});
function myPrompt() {
return $('<div></div>').kendoPrompt({
title: 'Kendo prompt',
value: '',
content: kendo.template($('#test').html()),
}).getKendoPrompt().open().result;
}
示例:剑道自定义提示
推荐阅读
- java - 在 Scala 中对 Java 列表进行平面映射
- android - 尝试 UnitTest 时,出现 Jacoco 错误。即使它没有使用
- google-cloud-platform - Terraform:自动进行身份验证以将 GCP 存储桶挂载到 VM
- c++ - 在初始化列表中强制转换 shared_ptr
- ios - 如何在 UITableView 中的分隔符附近添加按钮
- python - Intellij Python Selenium 驱动程序函数未从另一个函数调用
- javascript - 如何使用远程源映射调试混淆的前端代码
- excel - 有没有办法将结果分成不同的列
- python - Conditional aggregate for a PySpark dataframe
- vhdl - 组件与实体默认通用值