Add new row
Ok.... this should be Very simply;
I need to add a new row to a grid that has no data loaded just a blank grid with lets say 7 columns and 1 row. What I need to achieve is when I get to the last cell in the grid and you press enter it adds a new row... Simply hey!
Here's what I've tried and failed...
I'm thinking that if you evaluate the cell position/index and evaluates to the same as the last cell in the row/col of the grid it fires a function that adds the row!
My attempt/function works for the first insert but fails to insert after why?????
I need to add a new row to a grid that has no data loaded just a blank grid with lets say 7 columns and 1 row. What I need to achieve is when I get to the last cell in the grid and you press enter it adds a new row... Simply hey!
Here's what I've tried and failed...
I'm thinking that if you evaluate the cell position/index and evaluates to the same as the last cell in the row/col of the grid it fires a function that adds the row!
My attempt/function works for the first insert but fails to insert after why?????
obj.onKeyEnter = function(){
var currentRow = obj.getCurrentRow()+1;
var currentCol = obj.getCurrentColumn()+1;
var rowCount = obj.getRowCount();
var colCount = obj.getColumnCount();
var current = (currentRow + currentCol);
var evaluate = (rowCount + colCount);
if (current == evaluate) {
var i = obj.getRowCount()+1;
// update grid
obj.addRow(i);
obj.setRowCount(i);
}
}
Jez
February 26,