JSFiddle - React, Tailwind, and code Playground
http://forums.enyojs.com/discussion/2111/not-quite-getting-events
by Ryan Duffy
JavaScript
enyo.kind({
name: "ToDoList",
kind: "Control",
components: [
{name: "list", kind: "Repeater", onSetupItem: "setupItem", components: [
{name: "item", oninput: "itemChanged", components: [
{kind: "enyo.Checkbox", name: "checked"},
{tag: "span", content: " "},
{kind: "enyo.Input", name: "name", classes: "todo_name"}
]}
]}
],
itemChanged: function () {
console.log("itemChanged2")
},
setToDos: function (todos) {
this.todos = todos;
this.$.list.setCount(todos.length);
},
setupItem: function (inSender, inEvent) {
var index = inEvent.index;
var item = inEvent.item;
var todo = this.todos[index];
item.$.checked.setAttribute("checked", todo.checked);
item.$.name.setValue(todo.name);
return true;
},
addNew: function () {
this.todos.push({
checked: false,
name: ""
});
this.$.list.setCount(this.todos.length);
}
});
enyo.kind({
name: "MobileDo.MainView",
kind: "FittableRows",
itemChanged: function () {
console.log("itemChanged3")
},
components: [{
name: "toolbar",
kind: "onyx.Toolbar",
layoutKind: "FittableColumnsLayout",
components: [{
content: "MobileDo",
fit: true
}, {
kind: "onyx.Button",
classes: "onyx-affirmative",
content: "+",
ontap: "newToDo"
}]
}, {
name: "todo_list",
kind: "ToDoList",
fit: true
}, {
kind: "onyx.Toolbar",
components: []
}],
create: function () {
this.inherited(arguments);
this.$.todo_list.setToDos(this.initialToDos);
},
newToDo: function () {
this.$.todo_list.addNew();
},
initialToDos: [{
checked: true,
name: "Install MobileDo"
}, {
...