Skip to content

Instantly share code, notes, and snippets.

@wrumsby
Created July 18, 2013 09:15
Show Gist options
  • Select an option

  • Save wrumsby/6027918 to your computer and use it in GitHub Desktop.

Select an option

Save wrumsby/6027918 to your computer and use it in GitHub Desktop.
Defining a class with Ext.define.
Ext.define('My.ToDo.View', {
extend: 'Ext.view.View',
tpl: '<ul><tpl for="."><li class="todo<tpl if="isDone"> todo-done</tpl>">{description:htmlEncode}</li></tpl></ul>',
renderTo: Ext.getBody(),
itemSelector: '.todo',
baseCls: 'todo-list',
emptyText: 'No items',
listeners: {
itemclick: function (view, record) {
this.markDone(record);
}
},
markDone: function (record) {
var isDone = record.get('isDone');
if (isDone === false) {
record.set('isDone', true);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment