Kendo自动完成显示两个建议列表 [英] Kendo Autocomplete Displays Two Suggestion Lists

查看:54
本文介绍了Kendo自动完成显示两个建议列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Kendo自动完成控件成功检索了Json列表.不幸的是,它两次调用了MVC控制器方法并创建了两个建议列表.重复列表直接显示在第一个列表的后面.当从第一个建议列表中选择一个值时,该列表消失,但是重复列表仍然可见.我正在为自动完成控件使用包装器,如下所示.我已经确认该控件未在任何页面脚本中被引用.该控件位于一个局部视图中,该视图一次被添加到cshtml视图中(@{ Html.RenderPartial("_AddLineItem"); }).

My Kendo autocomplete control retrieves a Json list successfully. Unfortunately, it calls the MVC controller method twice and creates two suggestion lists. The duplicate list is displayed directly behind the first. When a value is selected from the first suggestion list, the list disappears, but the duplicate list remains visible. I am using a wrapper for the autocomplete control as shown below. I've confirmed that the control is not being referenced in any of the page scripts. The control is located in a partial view that is added to a cshtml view one time (@{ Html.RenderPartial("_AddLineItem"); }).

@(Html.Kendo().AutoComplete()
     .Name("CategorySearch")
     .DataTextField("CategoryName")
     .Filter("contains")
     .DataSource(source =>
     {
         source.Read(read =>
         {
             read.Action("PopulateCategories", "Default");
         })
         .ServerFiltering(false);
    })
)

生成的HTML两次显示建议列表,但是关联的输入控件仅存在一次.下列标记在生成的HTML中有两次(这些是建议列表的标记,它们还包含li标记和结束div标记,已从下面粘贴的HTML中删除了这些标记):

Generated HTML shows the suggestion list twice, but the associated input control only exists once. The following tags are in the generated HTML twice (these are tags for the suggestion list and they also contain li tags and closing div tags, removed from the pasted HTML below):

<div class="k-animation-container" style="left: 431.13px; top: 405.69px; width: 511px; height: 206px; overflow: hidden; padding-right: 2px; padding-bottom: 4px; padding-left: 2px; margin-left: -2px; display: none; position: absolute; z-index: 10002;">

有人知道这里发生了什么吗?

Does anyone have an idea of what is happening here?

推荐答案

根据我添加的注释,答案是避免将Kendo自动完成控件放在JQuery UI对话框控件中.该对话框会强制自动完成控件在浏览器中呈现两次.我已经在Internet Explorer和Firefox中确认了这一点.有理由假设其他浏览器中也会发生相同的行为.

Per the comment that I added, the answer is to avoid putting a Kendo autocomplete control inside a JQuery UI dialog control. The dialog forces the autocomplete control to be rendered twice in the browser. I've confirmed this in both Internet Explorer and Firefox. It is reasonable to assume that the same behavior will occur in other browsers as well.

这篇关于Kendo自动完成显示两个建议列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆