Skip to content

Instantly share code, notes, and snippets.

@xenophy
Created February 8, 2013 00:38
Show Gist options
  • Save xenophy/4735585 to your computer and use it in GitHub Desktop.
Save xenophy/4735585 to your computer and use it in GitHub Desktop.
var data = {
text: 'Groceries',
items: [{
text: '飲み物',
items: [{
text: '水',
items: [{
text: '炭酸水',
leaf: true
}, {
text: '無炭酸',
leaf: true
}]
}, {
text: '番茶',
leaf: true
}, {
text: '煎茶',
leaf: true
}, {
text: 'リポビタンD',
leaf: true
}, {
text: 'コカコーラ',
leaf: true
}, {
text: 'コカコーラゼロ',
leaf: true
}]
}, {
text: '果物',
items: [{
text: 'バナナ',
leaf: true
}, {
text: '檸檬',
leaf: true
}]
}, {
text: 'お菓子',
items: [{
text: '落花生',
leaf: true
}, {
text: 'プリッツ',
leaf: true
}, {
text: '山葵豆',
leaf: true
}]
}]
};
Ext.define('ListItem', {
extend: 'Ext.data.Model',
config: {
fields: [{
name: 'text',
type: 'string'
}]
}
});
var store = Ext.create('Ext.data.TreeStore', {
model: 'ListItem',
defaultRootProperty: 'items',
root: data
});
var nestedList = Ext.create('Ext.NestedList', {
fullscreen: true,
title: 'Groceries',
displayField: 'text',
store: store
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment