如何使用 Actionscript 清除数据网格中的数据?
我有一个弹性数据网格,我想在按钮单击事件后从中删除内容。如果我使用removeItemAt(myGrid.selectedIndex)方法,它工作正常,但removeAll()方法什么也不做。您在此处看到的 addData() 函数采用文本输入值并将它们发送到数据网格。
[Bindable]
public var originalData:ArrayCollection;
[Bindable]
public var changingData:ArrayCollection = new ArrayCollection();
public function addData(e:MouseEvent):void
{
this.originalData = new ArrayCollection( );
var obj:Object = new Object( );
obj.Value = parseInt(myText.text)
originalData.addItem( obj );
this.changingData.addItem(obj);
}
public function clearList():void
{
this.changingData.removeAll()
}
I have a flex datagrid that I would like to remove contents from after a button click event. If I use the removeItemAt(myGrid.selectedIndex) method it works fine but the removeAll() method does nothing. The addData() function you see here takes textinput values and sends them to the datagrid.
[Bindable]
public var originalData:ArrayCollection;
[Bindable]
public var changingData:ArrayCollection = new ArrayCollection();
public function addData(e:MouseEvent):void
{
this.originalData = new ArrayCollection( );
var obj:Object = new Object( );
obj.Value = parseInt(myText.text)
originalData.addItem( obj );
this.changingData.addItem(obj);
}
public function clearList():void
{
this.changingData.removeAll()
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该适合你:
This should work for you: