Skip to content

Instantly share code, notes, and snippets.

@dmackerman
Created January 3, 2013 17:01
Show Gist options
  • Select an option

  • Save dmackerman/4444914 to your computer and use it in GitHub Desktop.

Select an option

Save dmackerman/4444914 to your computer and use it in GitHub Desktop.
Ext.define('Workout.view.Workouts', {
extend : 'Ext.Container',
xtype : 'workouts',
config : {
title : 'Select Workout',
styleHtmlContent : true,
scrollable : {
direction : 'vertical',
directionLock : true
},
tpl : ''.concat(
'<ul class="workouts list">',
'<li class="list-divider">Today is</li>',
'<tpl for=".">',
'<li data-name="{name}"><a href="#">{name} <span class="chevron"></span></a></li>',
'</tpl>',
'</ul>'
)
},
initialize : function () {
var me = this;
me.setData(me.getData());
me.callParent();
me.element.on({
tap : me.onTap,
touchstart : me.onTouchStart,
touchend : me.onTouchEnd,
scope : me
});
},
onTouchStart: function (evtObj) {
var target = evtObj.getTarget('.workouts li');
target && Ext.fly(target).addCls('tapped');
},
onTouchEnd: function (evtObj) {
var target = evtObj.getTarget('.workouts li');
target && Ext.fly(target).removeCls('tapped');
},
onTap: function (evtObj) {
var target = evtObj.getTarget('.workouts li');
target && this.fireEvent('workoutSelected', target.dataset.name);
}
// initialize: function() {
// this.callParent();
// /* create our Manage button */
// var manageButton = Ext.create('Ext.Button', {
// id: 'btn-data-new',
// text: 'Manage',
// align: 'right',
// showAnimation: { type: 'fadeIn' },
// hideAnimation: { type: 'fadeOut', duration: 350 }
// });
// Ext.Viewport.getActiveItem().getNavigationBar().add(manageButton);
// },
// destroy: function() {
// this.callParent();
// var button = Ext.getCmp('btn-data-new');
// if (button) {
// Ext.Viewport.getActiveItem().getNavigationBar().remove(button);
// }
// }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment