1

我有一个高级数据网格。我想清除按钮单击时的高级数据网格值,我使用了 sales=new ArrayCollection 但它不起作用我的代码是:

[Bindable]
        private var sales:ArrayCollection = new ArrayCollection([
            {Billno:"1", customerName:"vs", 
                phoneno:"1223456789", productName:"aaer",serialNo: "ajerf", saleDate:" 12/5/2013", quantity:1, priceperitem:12,total: 12}, 
            {Billno:"2", customerName:"vs1", 
                phoneno:1223456789, productName:"aaer",serialNo: "ajerf", saleDate: " 12/5/2013", quantity:1, priceperitem:12,total: 12},  
            {Billno:"3", customerName:"vs", 
                phoneno:1223456789, productName:"aaer",serialNo: "ajerf", saleDate: " 12/5/2013", quantity:1, priceperitem:12,total: 12},  
            {Billno:"4", customerName:"vs1", 
                phoneno:1223456789, productName:"aaer",serialNo: "ajerf", saleDate: " 12/5/2013", quantity:1, priceperitem:12,total: 12},  
            {Billno:"5", customerName:"vs2", 
                phoneno:1223456789, productName:"aaer",serialNo: "ajerf", saleDate: " 12/5/2013", quantity:1, priceperitem:12,total: 12}, 
            {Billno:"6", customerName:"vs2", 
                phoneno:1223456789, productName:"aaer",serialNo: "ajerf", saleDate: " 12/5/2013", quantity:1, priceperitem:12,total: 12}  

        ]);

public function resetForm() :*
        {

            sales=new ArrayCollection();

        }

我的高级数据网格是:

<mx:AdvancedDataGrid id="myADG1" width="100%" height="100%" 
                     initialize="gc.refresh();" variableRowHeight="true">        
    <mx:dataProvider>
        <mx:GroupingCollection2 id="gc" source="{sales}">
            <mx:grouping>
            <mx:Grouping label="Billno">
                <mx:GroupingField name="customerName"/>

            </mx:Grouping>
            </mx:grouping>
        </mx:GroupingCollection2>
    </mx:dataProvider>        

    <mx:columns>
        <mx:AdvancedDataGridColumn width="125" dataField="customerName" headerText="customer"/>

</fx:Component> </mx:itemRenderer>-->

    </mx:columns>
</mx:AdvancedDataGrid>
4

1 回答 1

0

尝试这个:

public function resetForm():void {
       myADG1.removeAll();
       //sales = new ArrayCollection();//this should be null if you dont need the Grid anymore
       sales = null;
}


编辑:
如果您正在重用网格,最好使其源无效。

.invalidateList();

public function resetForm():void {
       sales = new ArrayCollection();
       myADG1.invalidateList();
    }
于 2013-06-24T08:29:11.803 回答