我有一个 AdvancedDataGrid 我想删除按钮单击时的行。我的代码是
[Bindable]
private var sales:ArrayCollection = new ArrayCollection([
{Sno:"1",categoryName:"biscuits",
description:"salt"},
{Sno:"2",categoryName:"biscuits",
description:"cream"},
{Sno:"3",categoryName:"sweets",
description:"less sweet"},
{Sno:"4",categoryName:"sweets",
description:"normal sweet"},
{Sno:"5",categoryName:"fruits",
description:"healthy "},
{Sno:"6",categoryName:"fruits",
description:"sweetfruits"}]);
private function deleteRows():void{
sales.removeItemAt(myADG1.selectedIndex);
}
我的网格是
<mx:AdvancedDataGrid id="myADG1" width="100%" height="100%" contentBackgroundColor="#F7F0F0"
initialize="gc.refresh();" variableRowHeight="true" >
<mx:dataProvider>
<mx:GroupingCollection2 id="gc" source="{sales}">
<mx:grouping>
<mx:Grouping label="Sno">
<mx:GroupingField name="categoryName"/>
</mx:Grouping>
</mx:grouping>
</mx:GroupingCollection2>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn width="125" dataField="Sno" headerText="Sno"/>
<mx:AdvancedDataGridColumn width="175" dataField="categoryName" headerText="CategoryName"/>
<mx:AdvancedDataGridColumn width="150" dataField="description" headerText="categoryDescription"/>
</mx:columns>
</mx:AdvancedDataGrid>
销售是我的数据提供者。上面的代码没有删除选定的行。任何人都可以帮助我。在此先感谢。