I have a script where I add a row automatically to the grid with addRow. There seems to be a bug. AddRow() doesn’t create the row if I don’t provide the array of column values. I want to be able to give only the id to create the blank row. Is there a different way to do that?
The problem was in the data being given to addRow(). I had to send an array of empty strings for the row columns. The code that worked is this:
[code]// Attach events
card_links_grid.attachEvent("onEnter", function(id,ind){
var row_index = this.getRowIndex(id);
var rows_count = this.getRowsNum();
// if last row automatically add new row
if (row_index == rows_count - 1) {
link_id = "u" + create_id();
this.addRow(link_id,[link_id,"",""]);
this.showRow(link_id);
this.setRowTextStyle(link_id, "border-right: 1px solid silver; border-bottom: 1px solid silver;");
}
});[/code]
In the line
this.addRow(link_id,[link_id,"",""]);
the first variable is the id for the row, then within the brackets there is an array of three variables one for each column: id, title, link. I specified the id column as hidden but that information was required in the call to addRow(), which makes sense.