简体   繁体   中英

Ext js get selected group records

I use a groupping feature on my grid. How can I get all the records belonging to a single group when clicking on the group. I have searched the docs but haven't found anything useful..

PLease help

Ext.data.Store implement getGroups( [groupName] ) method. This method returns an array containing the result of applying grouping to the records in this store. If you pass in an optional groupName argument it will returns information about specific group.

In your listener for grid's groupclick event you can get records which belongs to group like this:

listeners: {
    groupclick: function (view, node, group, e, eOpts) {

        // get array of records which belongs to clicked group
        var recordsInGroup = view.getStore().getGroups(group).children;
    }
}

Fiddle with example: https://fiddle.sencha.com/#fiddle/391

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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