Empty row always at bottom of grid
How would it be possible to keep an empty row always at the bottom? I've been looking through the API, but i don't really see anything that could support this as of now. Essentially what I'm looking for is being able to have an empty row at the bottom that will allow a user to type into it and then it will automatically create a new row after that one has been modified (even if it's only 1 cell). Also, is there a way to keep the tabbing within the grid? If i reach the end of the grid, it should hopefully go back to the top left most cell.
I have a function that checks wether the last object in the data Array of the grid have a custom property.
_this.IsLastRowEmpty = function(objUIGrid) {
var arrayData = null;
var retValue = false;
arrayData = objUIGrid.data;
retValue = Object.keys(arrayData[arrayData.length - 1]).length === 1 ? true : false;
return retValue;
};
I use this function in the following Event:
gridApi.edit.on.beginCellEdit($scope, function (rowEntity, colDef) {
if (!IsLastRowEmpty($scope.gridOrderPos)) {
$scope.gridOrderPos.data.push({});
};
});
When the last data object is not empty i simply push a empty object to the data Array.