Created
March 28, 2013 12:58
-
-
Save jbuda/5262918 to your computer and use it in GitHub Desktop.
Grouped Sencha List to show only 2 items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define 'groupedlist.store.Stories' | |
extend:'Ext.data.Store' | |
config: | |
model:'groupedlist.model.Story' | |
autoLoad:false | |
grouper: | |
groupFn:(record)-> | |
return record.get("section_name") | |
filters: | |
filterFn:(record)-> | |
groups = store.getGroups() | |
group = record.get('section_name'); | |
# for sections that do no exist in the group | |
sectionGroupExists = false | |
# loop over available groups | |
for k,v of groups | |
if v.name == group | |
sectionGroupExists = true | |
if (v.children.length < 2) | |
return group | |
# if the section does not exist, return the record to populate | |
if !sectionGroupExists | |
return group |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment