Need help with replacing DataProvider items

Hello, I have a datagrid with 5 columns and I want to manipulate its dataprovider. I’m trying to change dp’s first column dynamically. I have this code so far:

for (var i:uint = 0; i < dp.length; i++) {
        var tempArr:Array = new Array(dp.getItemAt(i));
        tempArr[0] = String(i);
        dp.replaceItemAt(tempArr, i);
}

However this empties all cells in datagrid. How can I fix this?

Anyway, I fixed this.

for (var i:uint = 0; i < dp.length; i++) {
        dataGrid.editField(i, "noCol", String(i + 1));
}