Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ext.regModel("Calendar", {
- fields: [
- {name: 'text', type: 'string'},
- {name: 'time', type: 'string'},
- {name: 'location', type: 'string'}
- ]
- });
- var calendarStore = new Ext.data.TreeStore({
- model: 'Calendar',
- proxy: {
- type: 'ajax',
- url : 'calendar.json',
- reader: {
- type: 'tree',
- root: 'children'
- }
- }
- });
- var calendarList = new Ext.NestedList({
- title: 'Calendar',
- iconCls: 'time',
- fullscreen: true,
- displayField: 'text',
- getDetailCard: function(recordNode, parentRecord) {
- var record = recordNode.getRecord();
- return new Ext.Panel({
- tpl: [
- '<div>{location}</div>',
- '<div>{text}</div>'
- ],
- border: false,
- bodyPadding: 5,
- center: true,
- data: record.data
- });
- },
- store: calendarStore
- });
- calendarList.on('leafitemtap', function(subList, subIdx, el, e, detailCard) {
- var ds = subList.getStore(),
- r = ds.getAt(subIdx);
- console.log(r.get('location'));
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement