PDA

View Full Version : Change list grouped:true to false?



nandhagopan
5 Jul 2011, 6:26 AM
I have 20 contacts in a list with grouped:true. I am filtering store content when i select a group name(work,friends) from dropbox. In this case friends group doesn't have any contacts so it's displaying emptyText "No Contacts in this Group".

My issue here is when there is no content for friends group still Grouped header (A,B,C..,)are there. How do i remove that dynamically?

Can any one help to get it of this?

nandhagopan
5 Jul 2011, 6:02 PM
Any expert can suggest how to get it done?

Jack9
5 Jul 2011, 7:19 PM
By default, getGroupString() on a store, creates groups from the results. So I'm not sure how you are getting group bars when you have no results.

I would love to see some code so I could prove this solution will work for you, but what you want is to override the getGroupString method in the store where you are setting grouped:true.

new Ext.data.Store({
...
grouped:true,
getGroupString:function(model){
if(!model.name){
return false;
}
},
...
});

or something like that.