Skip to content

Instantly share code, notes, and snippets.

@webOS101
Created September 15, 2014 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webOS101/09445bc43095f97a9a6c to your computer and use it in GitHub Desktop.
Save webOS101/09445bc43095f97a9a6c to your computer and use it in GitHub Desktop.
Advanced List Sample
enyo.ready(function() {
enyo.kind({
name: 'ListSample',
kind: 'List',
count: 1000,
items: [],
handlers: {
onSetupItem: 'setupItem'
},
components: [
{ name: 'text', kind: 'Input', ontap: 'tapped',
onchange: 'changed', onblur: 'blur' }
],
create: function() {
this.inherited(arguments);
for(var i = 0; i < this.count; i++) {
this.items[i] = 'This is row ' + i;
}
},
setupItem: function(sender, event) {
this.$.text.setValue(this.items[event.index]);
return(true);
},
tapped: function(sender, event) {
this.prepareRow(event.index);
this.set('$.text.value', this.items[event.index]);
this.$.text.focus();
return(true);
},
changed: function(sender, event) {
this.items[event.index] = sender.getValue();
},
blur: function(sender, event) {
this.lockRow();
}
});
new enyo.Application({ name: 'app', view: 'ListSample' });
});
name: Advanced List Sample
description: Demonstrating prepareRow() and lockRow() use with Lists
authors:
- Roy Sutton
normalize_css: no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment