how to track in gridview whether filter is applied or not in extjs?

感情迁移 提交于 2020-01-04 06:45:24

问题


My task is to put an image on the extjs grid column header whenever filter is applied in that column. When filter is cleared remove the image from the grid column header.

How to achieve this in extjs 3?


回答1:


In ExtJS 3.4 when filter is active on a column .ux-filtered-column class is added to the header cell. Easiest way is to add custom style for this class.




回答2:


GridView has a reference to the grid it is used by. Hence, you could use this.grid.store.isFiltered() to check whether store is filtered.

You probably want to perform such check in the listener function bind to datachanged event of grid's store:

initComponent: function() {
     ...
     this.grid.store.on('datachanged', this.yourDesiredFunction, this);
     ...
}

yourDesiredFunction: function(store) {
    if (store.isFiltered()) {
        // do your stuff
    }
}



回答3:


custom style for class .ux-filtered-column works good. However .ux-filtered-column is not getting added to the header cell if it is grouped header grid.




回答4:


i had the same problem.The .ux-filtered-column was not effective.But in that I added background image,which worked finally.



来源:https://stackoverflow.com/questions/13739034/how-to-track-in-gridview-whether-filter-is-applied-or-not-in-extjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!