【发布时间】:2017-01-06 22:49:18
【问题描述】:
我无法获得Kendo DropDownList 的内置搜索来使用模板化文本而不是来自数据源的原始文本。为了显示、值和搜索的目的,我想从数据源名称中去掉前导斜杠。
<script>
$("#dropdownlist").kendoDropDownList({
dataSource: [ "/Apples", "/Oranges" ],
// None of these templates appear to fix the search text.
// Kendo is using the dataSource item to search instead of the template output.
// I want to be able to search using 'a' (for Apples) or 'o' (for Oranges).
// If I use '/' then it cycles through the items which proves to me that the search is not using templated text.
template: function(t) { return t.name.slice(1); },
valueTemplate: function(t) { return t.name.slice(1); },
optionLabelTemplate : function (t) { return t.name.slice(1); },
});
</script>
这是 Kendo 的 UI 测试器中的一个不工作示例:
http://dojo.telerik.com/@Jeremy/UvOFo
我无法轻易更改服务器端的数据源。
如果无法更改搜索的工作方式,那么也许有办法在数据源从服务器加载到客户端后更改它?
【问题讨论】:
标签: kendo-ui telerik kendo-dropdown