3.2.0

BUG: Inconsistent behavior of getCurrentColumn

It took me a while to find a way around this bug in the Grid in version 2.0.1:

I need different behavior when the enter key is clicked, depending on the column. I decided to put the options in a switch/case structure. It turned out that getCurrentColumn was returning a digit if I had navigated to the cell using the arrow keys, but returning a string if I had selected the cell with the mouse!

My solution (which is obviously a work-around) was to cast the returned value to an integer in order to have consistent values to test in the switch cases.

Here's the code:

grid6.onKeyEnter = function(event){
gc = parseInt(grid6.getCurrentColumn());
gr = parseInt(grid6.getCurrentRow());
//alert("current cell: " + gc + "," + gr);
switch(gc){
case 0:
//alert("Setting default to row " + gr);
setDefaultRow(gr);
break;
case 1:
break;
case 2:
break;
case 3:
removeRow(gr);
break;
case 4:
//moveRowDown(gr);
break;
case 5:
//moveRowUp(gr);
break;
default:
//do nothing
break;
}
};
Paul S. Hoffman
January 10,
Yes, the original idea was to support any string in template indices, not just numbers, so you have to convert them to numbers for doing any arithmetics or numeric comparison. However I agree that the behavior should be at least consistent.
Alex (ActiveWidgets)
January 10,

This topic is archived.

See also:


Back to support forum