Created
February 8, 2013 00:38
-
-
Save xenophy/4735585 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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