GXT中的动态Autosuggest组合框 [英] Dynamic Autosuggest Combobox in GXT

查看:62
本文介绍了GXT中的动态Autosuggest组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的5个月中,我们一直在对GWT进行原型设计并建立基础架构.我们将GXT用于具有MVP和命令模式实现的小部件.但是,我们目前正在寻求通过实时数据库中的自动建议在ComboBox上实现峰值.我想在MVP和Command模式实现的框架中执行此操作.那里的任何人都有如何执行此操作的想法吗?

Over the past 5 months we have been prototyping GWT and setting up the infrastructure. WE are using GXT for the widgets with MVP and Command Pattern implementations. However, we are currently looking to do a spike on a ComboBox with autosuggest from a live Database. I would like to do this in the framework of the MVP and Command pattern implementations. Any one out there have any ideas how to go about doing this?

推荐答案

我使用在命令模式上建模的通用DispatchDataProxy解决了这一问题.感谢您提供的链接,但是尽管该框架确实非常不错而且很酷,但是GXT文档仍然有很多不足之处.

I solved that using a generic DispatchDataProxy modelled over the Command Pattern. Thanks for the link, but GXT documentation leaves a lot to be desired, though the framework is really nice and cool.

我将在此处发布代码`公共类DispatchDataProxy实现DataProxy> {

I will post the code here `public class DispatchDataProxy implements DataProxy> {

@Inject
private DispatchAsync dispatch ;//= new StandardDispatchAsync(new DefaultExceptionHandler());

@Override
public void load(DataReader<ListLoadResult<X>> reader, Object loadConfig, final AsyncCallback<ListLoadResult<X>> callback) {
    if (loadConfig instanceof BasePagingLoadConfig) {
        BasePagingLoadConfig a = (BasePagingLoadConfig) loadConfig;
        Map<String, Object> map = a.getProperties();
        Object data = map.get("query");

        XCommand action = new XCommand();
        action.setX((String) data);

        dispatch.execute(action, new AsyncCallback<XResult>() {

            @Override
            public void onFailure(Throwable arg0) {
                //Log.debug("Some error:" + arg0.getMessage());
                callback.onFailure(arg0);
            }

            @Override
            public void onSuccess(XResult arg0) {
                ListLoadResult<X> list = arg0.getList();
                callback.onSuccess(list);
            }
        });
    }
}

public DispatchAsync getDispatch() {
    return dispatch;
}

public void setDispatch(DispatchAsync dispatch) {
    this.dispatch = dispatch;
}

}`

希望它有用.也会感谢一些评论

Hope its useful. Will appreciate some comments as well

这篇关于GXT中的动态Autosuggest组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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