Reputation: 653
I’m trying to add a hold shift-click functionality to select a range of cells (Exactly what spread does in winforms by default).
What I’m trying to do is recognize when the shift key is first hit while the spread component is onfocus and saving the cell coordinates in hidden inputs.
For some reason, I cannot get a value from ActiveCol or ActiveRow. They are returning undefined. I tried presetting an active cell with code, but it is still returning undefined.
I also check the value of ‘ss’ and it’s returning an element.
function shiftCheckDown(event)
{
var ss = document.getElementById('<%=FpSpread1.ClientID %>');
//ss.SetActiveCell(0,3);
if (ss != null) {
var col = ss.ActiveCol;
var row = ss.ActiveRow;
//var col = FpSpread1.ActiveCol;
//var row = FpSpread1.ActiveRow;
if (event.keyCode == 16) {
alert(row);
document.getElementById('RowCoord').value = row;
document.getElementById('ColCoord').value = col;
}
}
}
I’m using an onkeydown to call the function.
<FarPoint:FpSpread onkeydown="shiftCheckDown(event)" ID="FpSpread1" runat="server" ActiveSheetViewIndex="0" . . .
Please let me know if you need more information.
Upvotes: 1
Views: 1195
Reputation: 1
Actually it is like this:
col = ss.GetActiveCol();
row = ss.GetActiveRow();
Upvotes: -1
Reputation: 653
ActiveCol
and ActiveRow
only works in IE
For Firefox and other browsers, you need to use GetActiveRow
and GetActiveCol
var col = ss.ActiveCol;
var row = ss.ActiveRow;
if (col == undefined) {
var col = ss.GetActiveCol;
var row = ss.GetActiveRow;
}
Upvotes: 1