Created
September 15, 2014 20:49
-
-
Save webOS101/09445bc43095f97a9a6c to your computer and use it in GitHub Desktop.
Advanced List Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' }); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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