通过JavaScript在AutoCompleteExtender重新显示结果列表 [英] Redisplay results list on AutoCompleteExtender through javascript

查看:273
本文介绍了通过JavaScript在AutoCompleteExtender重新显示结果列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个工作AutoCompleteExtender实现。

I have a working AutoCompleteExtender implementation.

我要的是,如果我已经退出了文本框,项目列表已经dissappeared,我想不必再次写在文本框中东西重新显示从JavaScript code列表(正是基于通过点击一个按钮或东西)在文本框中输入电流过滤器值重新显示列表。我知道如何从code中的AutoCompleteExtender行为对象,所以我需要的是知道对象,让我重新显示在列表上的JavaScript API。

What I want, is that if I have exited the text box, and the list of items have dissappeared, I want to re-display the list from javascript code without having to write something in the text box again (just redisplay list based on current filter value in text box by click on a button or something). I know how to get the AutoCompleteExtender Behaviour object from code, so all I need is to know the javascript API on that object that enables me to redisplay the list.

我已经试过这是在这个答案的意见建议,但不工作:

I have tried this as suggested in the comments on this answer, but not working:

AutoCompleteEx.showPopup();


我自己也尝试本作中建议这个答案,但不工作:

AutoCompleteEx._onTimerTick(AutoCompleteEx._timer, Sys.EventArgs.Empty);


编辑:结果
后由自动完成所使用的后端code一番调查,我想,也许是,一旦显示的问题,它会检查对未来的呼叫如果自上次在搜索框中输入值发生了变化,如果没有它doesn'再显示了。我还没有找到如何来解决这个问题。我曾尝试不同的方法来重置值,然后重新设置值,但没有成功。



After some investigation in the back end code used by the AutoComplete, I think maybe the problem is that once shown, it checks on future calls if the value in the search box has changed since last time, and if not it doesn't show it again. I have not found out how to come around this. I have tried different approaches to reset the value, and then set the value again, but with no success.

推荐答案

享受:)。这是一个有趣的任务。

Enjoy :). That's was an interesting task.

function redisplayAutocompleteExtender() {
    var extender = $find("AutoCompleteEx");
    var ev = { keyCode: 65, preventDefault: function () { }, stopPropagation: function () { } };
    extender._currentPrefix = "";
    extender._onKeyDown.call(extender, ev);
}

或者,你可以设置 EnableCaching 属性真正的扩展及以下使用脚本。该解决方案允许以避免额外的Web服务调用。

Or you can set EnableCaching property to true on extender and use script below. This solution allows to avoid additional web service call.

function redisplayAutoComplete() {
     var extender = $find("AutoCompleteEx");
     var textBox = extender.get_element();
     textBox.focus();
     var showSuggestions = function(){
          extender._update.call(extender, textBox.value, extender._cache[textBox.value], true);
     };
     setTimeout(showSuggestions, 0);
}

这篇关于通过JavaScript在AutoCompleteExtender重新显示结果列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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