Skip to content

Instantly share code, notes, and snippets.

@jbuda
Created March 28, 2013 12:58
Show Gist options
  • Save jbuda/5262918 to your computer and use it in GitHub Desktop.
Save jbuda/5262918 to your computer and use it in GitHub Desktop.
Grouped Sencha List to show only 2 items
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