0

我正在使用 GXT 的过滤网格(http://www.sencha.com/examples-2/#filtergrid)。应用过滤器后,我需要删除用户输入的过滤文本。

在此处输入图像描述

是否可以在没有用户干预的情况下以编程方式删除“abc”文本?

谢谢!

4

1 回答 1

0

请尝试以下代码。我没有测试过这个。

new StringFilter("someValue") {
            @Override
            protected void fireUpdate() {
                super.fireUpdate();
                List<Component> items = menu.getItems();
                if (!items.isEmpty()) {
                    ((Field) items.get(0)).setValue("");
                }
// Not tested this. If the above code is not working try to get the 
textfield instance somehow from the menu and clear it 
            }

        };

如果您只想清除用户键输入上的值而不是编程过滤器上的值(通过 setValue()),那么上述方法将不起作用。您必须覆盖 onFieldKeyUp 方法并使用一些调度程序清除它。

于 2012-06-28T07:50:41.490 回答