# dataGrid removeItemAT doesn t work as i would like

**URL:** <https://forum.kirupa.com/t/datagrid-removeitemat-doesn-t-work-as-i-would-like/260299>\
**Category:** flash\
**Created:** [May 14, 2008, 9:45am UTC](https://forum.kirupa.com/t/datagrid-removeitemat-doesn-t-work-as-i-would-like/260299 "2008-05-14T09:45:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![greenshot](https://avatars.discourse-cdn.com/v4/letter/g/ed8c4c/32.png) [@greenshot](https://forum.kirupa.com/u/greenshot)\
**Post date:** [May 14, 2008, 9:45am UTC](https://forum.kirupa.com/t/datagrid-removeitemat-doesn-t-work-as-i-would-like/260299/1 "2008-05-14T09:45:16Z")

</div>

hello everyone,

i ve a problem about my script that should show me entries of an xml file :

```auto
<?xml version="1.0" encoding="utf-8" ?> 
<videos>
   <video name="motion 01" genre="motion" data="thumbs/motion01.jpg" />
   <video name="motion 02" genre="abstrait" data="thumbs/motion02.jpg" />
   <video name="motion 03" genre="art video" data="thumbs/motion03.jpg" /> 
   <video name="motion 04" genre="motion" data="thumbs/motion04.jpg" />
   <video name="motion 05" genre="abstrait" data="thumbs/motion05.jpg" />
   <video name="motion 06" genre="art video" data="thumbs/motion06.jpg" /> 
   <video name="motion 07" genre="motion" data="thumbs/motion07.jpg" />
</videos>

```

inside a dataGrid (myDataP1) versus their attributes “genre”.  
the loading in the dataGrid is ok, when i click to btSort with that script it’s ok

```auto
function monTri(evt:Event):void {
    //myXML = new XML(evt.target.data);
    var myDP = new DataProvider(myXML);
        myDP.sortOn("genre");// classe les genres
    if (myXML.video.(@genre=="motion")) {
        for (var i:uint = 0; i < myDP.length; i++) {
            myDP.removeItemAt(myXML.video.(@genre!=="motion"));
        }
        myDataP1.dataProvider = myDP;
    }
}
btSort.addEventListener(MouseEvent.CLICK, monTri);

```

the problem happen when i want to click on a second button that should change entries of dataP1 with another @genre …

```auto
function monTri2(evt:Event):void {
    //myXML = new XML(evt.target.data);
    var myDP = new DataProvider(myXML);
    myDP.sortOn("genre");
    if (myXML.video.(@genre!=="abstrait")) {
        for (var i:uint = 0; i < myDP.length; i++) {
            myDP.removeItemAt(myXML.video.(@genre!=="abstrait"));
        }
        myDataP1.dataProvider = myDP;
    }
}
btSort2.addEventListener(MouseEvent.CLICK, monTri2);

```

i don’t understand and if anyone as an idea of what’s going on it will be very helpfull.  
Thanks you.
