Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete all rows in a DataGrid

I need to delete all existing rows from a data grid, i have tried using this but doesn't work:

    public function GetMusicList(obj:Object):void{

        for(var j = 0; j < mc_music.datagrid.rowCount; j++){
            mc_music.datagrid.dataProvider.removeItemAt(0);
        }

        for(var i = 0; i < obj.length; i++){
            mc_music.datagrid.addItem({Name: obj[i].toString()});
        }   
    }
like image 662
redoc01 Avatar asked Feb 16 '26 01:02

redoc01


1 Answers

Your title is asking a different question than your actual question, but to remove all the rows just do datagrid.removeAll();

like image 74
Ronnie Avatar answered Feb 17 '26 19:02

Ronnie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!