New content function within containeritem for easy text manipulation
Change-Id: If4ca3bb317af35449a25b9924501c64f19a7c95e
diff --git a/dev/demo/containermenudemo.js b/dev/demo/containermenudemo.js
index f1f66c0..2983230 100644
--- a/dev/demo/containermenudemo.js
+++ b/dev/demo/containermenudemo.js
@@ -24,9 +24,8 @@
},
// enter or click
- onclick : function (event) {
+ onclick : function () {
console.log(this._name);
- event.halt();
},
// right arrow
@@ -42,7 +41,7 @@
this._name = params[0];
this._content = document.createTextNode(this._name);
this._lcField = ' ' + this.content().textContent.toLowerCase();
- this._i=0;
+ this.newLimit=0;
return this;
}
};
@@ -69,17 +68,10 @@
further : function () {
this.value = this.value + this.value;
},
- isSelectable : function () {
- return (this.value !== "");
- },
- chop : function () {
- console.log("chop");
- console.log(this.content(this.value));
- },
onclick : function () {
console.log('ContainerItem ' + this.value);
- console.log(this._i);
- this._menu.limit(this._i);
+ console.log(this.newLimit);
+ this._menu.limit(this.newLimit);
this._menu.show();
}
};
@@ -89,13 +81,14 @@
ExampleItemList.push(OwnContainerItemClass.create());
ExampleItemList.push(OwnContainerItemClass.create());
ExampleItemList[0].value = "Example Item 1";
- ExampleItemList[0]._i = 3;
- ExampleItemList[1]._i = 4;
+ ExampleItemList[0].newLimit = 3;
+ ExampleItemList[1].newLimit = 4;
ExampleItemList[2].value = "Remove the Prefix Test";
- ExampleItemList[2]._i=5;
+ ExampleItemList[2].newLimit=5;
ExampleItemList[2].onclick = function (e) {
- this._menu.container().removeItemByIndex(3);
- //Should fail, that's ok. You can also try index 0 for testing functionality.
+ this._menu.container().addItem({defaultTextValue: "new", newLimit:4 })
+ this.initContent("I created a new item");
+ this._menu.container().removeItemByIndex(0);
};
//Own container class.
@@ -220,7 +213,7 @@
document.getElementById('menu').appendChild(menu.element());
//document.getElementById('largemenu').appendChild(largeMenu.element());
- menu.container().addItem({ value : "Dynamically added", defaultTextValue : "dynamic", _i : 5})
+ menu.container().addItem({ value : "Dynamically added", defaultTextValue : "dynamic", newLimit : 5})
menu.limit(3).show(3);
menu.focus();