ExtJS ::如何过滤网格中的行,但不存储(ExtJS:: How to filter rows in grid, but not in store)

编程入门 行业动态 更新时间:2024-10-23 13:22:26
ExtJS ::如何过滤网格中的行,但不存储(ExtJS:: How to filter rows in grid, but not in store)

我有两个网格,都有一个商店。 我需要在第一家商店展示一切,并在第二家店展示特殊数据。

示例:第一个商店显示每条记录,第二个商店显示类型= 12的记录。如何在网格中进行过滤,而不是在商店中进行过滤。 我需要两个不同的网格,而不是一个过滤。

如果我会按商店筛选第二个网格中的记录,那么它会先隐藏起来。 我将同时看到它,并且我需要同时看到它们中的不同数据。 我只需要一家商店。

I have two grids, thay both have one store. I need to show everything in first store, and special data from this store in second.

Example: First store shows every record, second store shown records with type = 12. How can I do filtering in grid, not in store. I need TWO different grids, not one with filtering.

If I will filter records in second grid by store, thay will hide in first. I will see it at the same time, and I need to see different data in them at the same time. And I need only one store.

最满意答案

一种好的方法是在第二个网格中重写GridView对象的getRowClass()方法:

var secondGrid = new Ext.grid.GridPanel({ //.. viewConfig: { getRowClass: function(record, index) { if (record.get('type') != '12') { return 'display-false'; } } } });

你也应该定义一个CSS类:

.display-false { display: none }

试试这个解决方案

One good way is to override the method getRowClass() of GridView object in second grid:

var secondGrid = new Ext.grid.GridPanel({ //.. viewConfig: { getRowClass: function(record, index) { if (record.get('type') != '12') { return 'display-false'; } } } });

Also you should define a CSS class:

.display-false { display: none }

Try this solution!

更多推荐

本文发布于:2023-08-04 07:00:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1413078.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:网格   但不   ExtJS   filter   store

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!