Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                     Ext.regModel("Calendar", {
  2.                         fields: [
  3.                                 {name: 'text',      type: 'string'},
  4.                                 {name: 'time',      type: 'string'},
  5.                                 {name: 'location',  type: 'string'}            
  6.                             ]      
  7.                         });
  8.                        
  9.                     var calendarStore = new Ext.data.TreeStore({
  10.                         model: 'Calendar',
  11.                             proxy: {
  12.                                 type: 'ajax',
  13.                                 url : 'calendar.json',
  14.                                 reader: {
  15.                                     type: 'tree',
  16.                                     root: 'children'
  17.                                 }
  18.                             }
  19.                         });
  20.            
  21.                     var calendarList = new Ext.NestedList({
  22.                         title: 'Calendar',
  23.                         iconCls: 'time',           
  24.                         fullscreen: true,
  25.                         displayField: 'text',
  26.                         getDetailCard: function(recordNode, parentRecord) {
  27.                             var record = recordNode.getRecord();
  28.                             return new Ext.Panel({
  29.                                 tpl: [
  30.                                     '<div>{location}</div>',
  31.                                     '<div>{text}</div>'
  32.                                 ],
  33.                                 border: false,
  34.                                 bodyPadding: 5,
  35.                                 center: true,
  36.                                 data: record.data
  37.                             });
  38.                         },
  39.                         store: calendarStore
  40.                     });
  41.            
  42.                     calendarList.on('leafitemtap', function(subList, subIdx, el, e, detailCard) {
  43.                         var ds = subList.getStore(),
  44.                         r  = ds.getAt(subIdx);
  45.                        
  46.                         console.log(r.get('location'));
  47.                     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement