# Need help with replacing DataProvider items

**URL:** <https://forum.kirupa.com/t/need-help-with-replacing-dataprovider-items/583179>\
**Category:** flash\
**Created:** [March 18, 2015, 6:59am UTC](https://forum.kirupa.com/t/need-help-with-replacing-dataprovider-items/583179 "2015-03-18T06:59:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![onurcan1977](https://avatars.discourse-cdn.com/v4/letter/o/9e8a1a/32.png) [@onurcan1977](https://forum.kirupa.com/u/onurcan1977)\
**Post date:** [March 18, 2015, 6:59am UTC](https://forum.kirupa.com/t/need-help-with-replacing-dataprovider-items/583179/1 "2015-03-18T06:59:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![onurcan1977](https://avatars.discourse-cdn.com/v4/letter/o/9e8a1a/32.png) [@onurcan1977](https://forum.kirupa.com/u/onurcan1977)\
**Post date:** [March 18, 2015, 9:00am UTC](https://forum.kirupa.com/t/need-help-with-replacing-dataprovider-items/583179/2 "2015-03-18T09:00:44Z")

</div>

Anyway, I fixed this.

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