简体   繁体   English

GXT Grid过滤商店

[英]GXT Grid filtering a store

I understand that in GXT 3.0 grids are pulling their data from a store (in my case a list store). 我了解在GXT 3.0中,网格正在从存储(在我的情况下是列表存储)中提取其数据。 I am trying to implement a search function to help filter through some of the results in the grid dynamically. 我正在尝试实现搜索功能,以帮助动态过滤网格中的某些结果。 However, I am having trouble determining the best method to do this. 但是,我在确定执行此操作的最佳方法时遇到了麻烦。 I have considered doing this server side by modifying the source file..but ultimately I just want to toggle the displaying of a row if it doesn't contain a desired string. 我曾考虑过通过修改源文件来做这个服务器端。但是最终,我只想切换行的显示(如果它不包含所需的字符串)。 Any suggestions for how to best approach this? 关于如何最好地解决此问题的任何建议?

You can try using store filter to toggle displaying row that contains the string you desired. 您可以尝试使用商店过滤器来切换显示包含所需字符串的行。 Here is the example code: 这是示例代码:

ListStore<YourModelData> listStore = new ListStore<YourModelData>(yourPropertiesObject.key());
StoreFilter<YourModelData> sf = new StoreFilter<YourModelData>() {
    @Override
    public boolean select(Store<YourModelData> store, YourModelData parent,
            YourModelData item) {
        return item.contains("some-string");
    }
};
listStore.addFilter(sf);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM