Combo in 2.0.2 search combo while typing
I am trying to make the combo box (in a grid) act like a selection list where a keypress searches the items in the list.
I located several articles on this forum including:
/javascript.forum.17612.2/combobox-and-grid-combobox-autocomplete.html
When I add the sample code, they either returns errors about methods not being defined, or they never get called in the code.
Using the autocomplete code, this line returns an error whether I ty to define the autoCompleteCombo method on the grid object or the list object:
Grid_Items_Items.getCellTemplate(3).setEvent("onkeyup",autoCompleteCombo);
In the code below inventory is my grid object, this code is creating the combo boxes, am I doing something wrong in defining the list that is causing the searching problem?
inventory.setPopupTemplate(function(col, row){
var list = new AW.UI.List;
if (col == 5) {
list.setItemText(categories);
list.setItemCount(categories.length-1);
list.onItemClicked = function(event, i){
var value = this.getItemText(i);
inventory.setCellValue(value, col, row);
inventory.setCellText(value, col, row);
inventory.getCellTemplate(col, row).hidePopup();
if (previousRow == -1)
previousRow = row;
if (row != previousRow)
inventory.onCurrentRowChanged(row);
changedRow[col] = value;
//alert("col:"+col+", row:"+row+", value:"+value);
}
} else if (col == 7) {
list.setItemText(manufactures);
list.setItemCount(manufactures.length-1);
list.onItemClicked = function(event, i){
var value = this.getItemText(i);
inventory.setCellValue(value, col, row);
inventory.setCellText(value, col, row);
inventory.getCellTemplate(col, row).hidePopup();
if (previousRow == -1)
previousRow = row;
if (row != previousRow)
inventory.onCurrentRowChanged(row);
changedRow[col] = value;
//alert("col:"+col+", row:"+row+", value:"+value);
}
}
list.onControlTextChanged = function(text){
alert("test");
if (text!=lastvalue) {
var foundit=false;
for (var x = 0; x <= dropdowntext.length-1; x++) {
if (dropdowntext[x].toUppercase==text.toUpperCase) {
foundit=true;
break;
}
}
if (foundit==false) {
obj.setControlText(lastvalue);
this.showPopup(); }
};
lastvalue=obj.getControlText();
}
list.onControlActivated = function(event){ lastvalue=obj.getControlText(); };
return list;
});
I located several articles on this forum including:
/javascript.forum.17612.2/combobox-and-grid-combobox-autocomplete.html
When I add the sample code, they either returns errors about methods not being defined, or they never get called in the code.
Using the autocomplete code, this line returns an error whether I ty to define the autoCompleteCombo method on the grid object or the list object:
Grid_Items_Items.getCellTemplate(3).setEvent("onkeyup",autoCompleteCombo);
In the code below inventory is my grid object, this code is creating the combo boxes, am I doing something wrong in defining the list that is causing the searching problem?
inventory.setPopupTemplate(function(col, row){
var list = new AW.UI.List;
if (col == 5) {
list.setItemText(categories);
list.setItemCount(categories.length-1);
list.onItemClicked = function(event, i){
var value = this.getItemText(i);
inventory.setCellValue(value, col, row);
inventory.setCellText(value, col, row);
inventory.getCellTemplate(col, row).hidePopup();
if (previousRow == -1)
previousRow = row;
if (row != previousRow)
inventory.onCurrentRowChanged(row);
changedRow[col] = value;
//alert("col:"+col+", row:"+row+", value:"+value);
}
} else if (col == 7) {
list.setItemText(manufactures);
list.setItemCount(manufactures.length-1);
list.onItemClicked = function(event, i){
var value = this.getItemText(i);
inventory.setCellValue(value, col, row);
inventory.setCellText(value, col, row);
inventory.getCellTemplate(col, row).hidePopup();
if (previousRow == -1)
previousRow = row;
if (row != previousRow)
inventory.onCurrentRowChanged(row);
changedRow[col] = value;
//alert("col:"+col+", row:"+row+", value:"+value);
}
}
list.onControlTextChanged = function(text){
alert("test");
if (text!=lastvalue) {
var foundit=false;
for (var x = 0; x <= dropdowntext.length-1; x++) {
if (dropdowntext[x].toUppercase==text.toUpperCase) {
foundit=true;
break;
}
}
if (foundit==false) {
obj.setControlText(lastvalue);
this.showPopup(); }
};
lastvalue=obj.getControlText();
}
list.onControlActivated = function(event){ lastvalue=obj.getControlText(); };
return list;
});
Paul R.
March 31,