:: Documentation >>

addRow

Adds the new row to the grid.

addRow() method inserts the index of the new row at the end of the row indices array and adds the row html to the display without full grid refresh.

addRow() method does not add the row to the datasource - you should first add the row to the datasource and then update the grid with addRow(index) passing the index of the new row as an argument.

This method triggers onRowAdding and onRowAdded events.

null

Syntax

obj.addRow(index);

Parameters

index (string/number) - index of the new row in the datasource

Examples

var myData = [
    ["row 0", 0]
]

var obj = new AW.UI.Grid;
obj.setCellData(myData);
obj.setColumnCount(2);
obj.setRowCount(1);
document.write(obj);

function addRow(){
    // calc new row index
    var i = myData.length;

    // add row to the datasource
    myData[i] = ["row " + i, i];

    // update grid
    obj.addRow(i);
}

Remarks

Currently it is not possible to insert the new row in the middle of the grid - it is always added as a last row.

See also

deleteRow method, row indices property, row events

Comments

Update a row Guillaume (3)
addRow() clears the value of the cell immediately proceeding the added row Brad (1)
Data in all added rows is same Amit Joshi (3)
addRow without change of scroll position Volker Niepel (4)
Auto Resize a row - version 2.0.1 (1)
Bug in addRow() if datasource was empty Robin (2)
Behavior when editing, adding records - not friendly like MS Access or Excel? Ron (3)
inserting Rows Chris Angus (3)
Insert a row below current selected one Yevaud (3)
Add row for XML Tobias (1)
No vertical scrollbar after adding rows Jose Luis (Spain) (3)
Cannot add/delete Bryan Smith (0)

Documentation:

Recent changes:

2.6.4
2.6.3
2.6.2
2.6.1
2.6.1
2.6.0
2.5.0 - 2.5.6
2.5.6
2.5.0 - 2.5.5
2.5.5