AutoCompleteExtender定位菜单在滚动时不正确 [英] AutoCompleteExtender positioning menu incorrectly when scrolled

查看:102
本文介绍了AutoCompleteExtender定位菜单在滚动时不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个链接到TextBox的AutoCompleteExtender。这两个控件都放置在UpdatePanel内,并且使用Javascript库(Ext.BasicDialog)将UpdatePanel显示为弹出对话框。

We have an AutoCompleteExtender linked to a TextBox. Both controls are placed inside an UpdatePanel, and the UpdatePanel is displayed as a pop-up dialog using a Javascript library (Ext.BasicDialog).

弹出窗口是页面上的div,而不是单独的窗口。
问题是,当用户在弹出窗口中滚动时,AutoCompleteExtender会在错误的位置显示其菜单。看起来好像要从弹出窗口的顶部开始看得见的距离,然后从弹出窗口的内部html的顶部开始放置菜单(这是不可见的)

The pop-up is a div on the page, not a separate window. The problem is that when the user scrolls inside the pop-up, the AutoCompleteExtender shows its menu in the wrong place. It looks like it is taking the visible distance from the top of the popup and positioning the menu from the top of the inner html of the popup (which is not visible)

我们正在使用AjaxControlToolkit的1.0.20229.20821版本,并且我们的目标是ASP.NET Framework vewrsion 2.0。

We are using Version 1.0.20229.20821 of the AjaxControlToolkit, and we are targetting ASP.NET Framework vewrsion 2.0.

我试图通过将以下Javascript附加到以下菜单来修复菜单OnClientShown事件,但它几乎做同样的事情:

I have tried to fix the menu by attaching the following Javascript to the OnClientShown event, but it pretty much does the same thing:

function resetPosition(object, args) {

    var tb = object._element; // tb is the associated textbox.
    var offset = $('#' + tb.id).offset();

    var ex = object._completionListElement;
    if (ex) {
        $('#' + ex.id).offset(offset);
    }  
} 


推荐答案

I通过在包含TextBox和自动完成扩展器的div上设置 position:relative 来解决此问题。扩展器在弹出面板内时必须使用错误的元素定位。

I fixed this by setting position:relative on a div containing the TextBox and the auto-complete extender. The extender must have been using the wrong element to position on when inside the popup panel.

这篇关于AutoCompleteExtender定位菜单在滚动时不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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