New menu class that has an entry at the very end, similar to the input
text prefix, that is always available
Change-Id: I03d8f689e37021d3daac6bf34f7d35f0e4d71999
diff --git a/dev/js/src/menu.js b/dev/js/src/menu.js
index 01bf7d8..088618b 100644
--- a/dev/js/src/menu.js
+++ b/dev/js/src/menu.js
@@ -60,6 +60,7 @@
params = {};
const t = this;
+ t._notItemElements=3;
t._itemClass = params["itemClass"] || defaultItemClass;
@@ -127,7 +128,7 @@
t._limit = menuLimit;
- t._items = new Array();
+ t._items = new Array(); //all childNodes, i.e. ItemClass, prefixClass
// TODO:
// Make this separate from _init
@@ -142,7 +143,7 @@
readItems : function (list) {
const t = this;
- t._list = undefined;
+ t._list = undefined; //filtered List containing all itemClass items
// Remove circular reference to "this" in items
for (let i = 0; i < t._items.length; i++) {
@@ -179,6 +180,7 @@
// Initialize the item list
_initList : function () {
+ // Upon change also update alwaysmenu.js please
const t = this;
// Create a new list
@@ -258,6 +260,7 @@
* mark and sweep GC)!
*/
destroy : function () {
+ // Upon change also update alwaysmenu.js please
const t = this;
// Remove circular reference to "this" in menu
@@ -327,6 +330,7 @@
// Arrow key and prefix treatment
_keydown : function (e) {
+ //Upon change also update alwaysmenu.js please
const t = this;
switch (_codeFromEvent(e)) {
@@ -489,6 +493,7 @@
* @param {string} Prefix for filtering the list
*/
show : function (active) {
+ //Upon change please also update alwaysmenu.js (only two lines new there)
const t = this;
// show menu based on initial offset
@@ -623,6 +628,7 @@
this._el.removeChild(liElements[0]);
};
},
+
/**
@@ -686,6 +692,7 @@
* Make the next item in the filtered menu active
*/
next : function () {
+ //Upon change please update alwaysmenu.js next
const t = this;
// No list
@@ -742,6 +749,7 @@
* Make the previous item in the menu active
*/
prev : function () {
+ //Upon Change please update alwaysmenu.js prev
const t = this;
// No list
@@ -870,7 +878,7 @@
// Remove the HTML node from the first item
// leave lengthField/prefix/slider
- t._el.removeChild(t._el.children[3]);
+ t._el.removeChild(t._el.children[this._notItemElements]);
t._append(
t._list[t.offset + t.limit() - 1]
@@ -943,7 +951,7 @@
// Append element after lengthField/prefix/slider
e.insertBefore(
item.element(),
- e.children[3]
+ e.children[this._notItemElements]
);
}
};