Grid Combo box - the Saga continues
OK - after many hours - very close to completing properly behaving combo box in a grid.
Two issues remain:
1. keyboard navigation of the popup - typing a letter jumps to value beggining with that letter and using up/down arrow keys moves selection up and down in the list
2. closing the popup (by using esc key or clicking "box" of combo) somehow leaves the box of the combo editable (you can type your own text).
I'll expound on #1 here:
I am using recommended list/combo format where the list is an AW.UI.List popup for a Combo template - kindof like this:
My code is much more extensive than this, but it follows this design guideline. I have added onkeypress functionality to the combo like this:
I am happy to share the complete code, but its not actually relevant to the issue I'm having. This autoCompleteCombo function is a hacked up version of some code i found here on the forum - its able to grab the letter you type, find a match in the list and set the selected item.
HERE IS THE ISSUE: When you programatically set the selected items of the list (in the onkeypress code) - there is no way i have found to be able to update/show that selected item in the popup.
heres how i set the selected items in the popup:
I know this part works, because i have code attached to the list.onSelectedItemsChanged event/method - and it fires as expected when you set the selected item as above.
I have tried doing a list.refresh(), list.refreshContent(), _viewTemplate.refresh(), _boxContent.refresh().... etc etc etc
The popup itself is easy enough to reference - i have a function that dumps all its properties/methods and nothing i try seems to actually change what is displayed on-screen.
I thought maybe this might have something to do with timing, so tried a few different setTimeOut calls in my code which had no effect either.
This is probably something you would only have run into if you are attempting something similar to what i'm trying, where you are trying to navigate the list popup using the keyboard and not force the user to grab the mouse to change their selection.
Sorry for the long-winded post. Anyone have suggestions for me to update/refresh the list to show the newly selected value?
Two issues remain:
1. keyboard navigation of the popup - typing a letter jumps to value beggining with that letter and using up/down arrow keys moves selection up and down in the list
2. closing the popup (by using esc key or clicking "box" of combo) somehow leaves the box of the combo editable (you can type your own text).
I'll expound on #1 here:
I am using recommended list/combo format where the list is an AW.UI.List popup for a Combo template - kindof like this:
var list = new AW.UI.List;
list.setItemText(function(i){return "Item " + i});
list.setItemCount(25);
var obj = new AW.UI.Grid;
obj.setCellData("cell");
obj.setHeaderText("header");
obj.setColumnCount(10);
obj.setRowCount(10);
obj.setCellEditable(true);
obj.combo1 = new AW.Templates.Combo
obj.setCellTemplate(obj.combo1, 1);
obj.setPopupTemplate(list);
document.write(obj);
My code is much more extensive than this, but it follows this design guideline. I have added onkeypress functionality to the combo like this:
obj.combo1.setEvent("onkeypress", function(key){return autoCompleteCombo(key,obj.list6,this.$0,this.$1,grid);});
I am happy to share the complete code, but its not actually relevant to the issue I'm having. This autoCompleteCombo function is a hacked up version of some code i found here on the forum - its able to grab the letter you type, find a match in the list and set the selected item.
HERE IS THE ISSUE: When you programatically set the selected items of the list (in the onkeypress code) - there is no way i have found to be able to update/show that selected item in the popup.
heres how i set the selected items in the popup:
list.setCurrentItem(i);
list.setSelectedItems([i]);
I know this part works, because i have code attached to the list.onSelectedItemsChanged event/method - and it fires as expected when you set the selected item as above.
I have tried doing a list.refresh(), list.refreshContent(), _viewTemplate.refresh(), _boxContent.refresh().... etc etc etc
The popup itself is easy enough to reference - i have a function that dumps all its properties/methods and nothing i try seems to actually change what is displayed on-screen.
I thought maybe this might have something to do with timing, so tried a few different setTimeOut calls in my code which had no effect either.
This is probably something you would only have run into if you are attempting something similar to what i'm trying, where you are trying to navigate the list popup using the keyboard and not force the user to grab the mouse to change their selection.
Sorry for the long-winded post. Anyone have suggestions for me to update/refresh the list to show the newly selected value?
Ben W (ScheduleForce)
December 30,