3.0 beta 2

How to add keyboard event onkeyUp/onkeyDown to list items in grid

Hi Alex,

Please help me on this i went back and tried _actions.js and _single.js as you suggested but no use this is really bugging me

My main problem is that i can't get 'i ' (selected index)value
My code goes like below
case 'combo':
combo = new AW.Templates.Combo;
combo.setItemText(fetchComponentDataFromRemote(colList[m].dataHook));
this.obj.setCellTemplate(combo, m);
var self = this;
this.obj.setPopupTemplate(function(col, row){
var grid = this;

var list = new AW.UI.List;
labels = changeComboCodes(col, row);
list.setItemText(mlabels);
list.setItemCount(mlabels.length);

list.onItemMouseOver = function(event, i){iVal=i; return list.getItemTemplate(i).setStyle("background", "#ccc")}; //works fine

list.onItemMouseDown= function(event, i){return list.getItemTemplate(i).setStyle("background", "#999")};//works fine

list.onItemMouseOut = function(event, i){ iVal=i; return list.getItemTemplate(i).setStyle("background", "#fff")};//works fine

//Here is where i want to add keyboard event
list.onItemKeyUp= function(event,i){ //
alert(i)//return undefined ( i tried declaring in _single file and calling relevant function no result found)
//end

//below code works fine
list.onItemClicked = function(event, i){
var text = this.getItemText(i);
grid.setCellText(labels[i], col, row);
grid.setCellValue(values[i], col, row);
grid.getCellTemplate(col, row).hidePopup();
}
return list;

In /source/lib/ui/_sungle.js

//I have added both
onItemKeyUp: "gotoPreviousItem", // 'i' is undefined in these case
onItemKeyDown: "gotoNextItem",

onKeyUp: "gotoPreviousItem",//this works for grid rows not for list item
onKeyDown:"gotoNextItem",//this works for grid rows not for list item
onItemClicked:"selectClickedItem"//works fine


/source/lib/ui/_actions.js

gotoPreviousItem: f(go, previous),
gotoNextItem: f(go, next),

Please help me on this
sufiya
December 18,
Pls anybody comment on this
December 26,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.