带分层数据的 Flex 高级数据网格:如何在拖放事件上访问 currentTarget 字段?
所以这让我发疯。我有一个带有数据提供者的高级数据网格,该数据提供者是带有分层数据的数组集合。每个对象(包括子对象)都有一个 id 字段。我正在尝试从 ADG 中拖放数据。发生这种情况时,我需要从放置目标中获取 id 并更改拖动对象的parentid 字段。这就是我所得到的:
public function topAccountsGrid_dragDropHandler(event:DragEvent):void{
//In this function, you need to make the move, update the field in salesforce, and refresh the salesforce data...
if(checkActivateAccountManageMode.selected == true) {
var dragObj:Array = event.dragSource.dataForFormat("treeDataGridItems") as Array;
var newParentId:String = event.currentTarget['Id'];
dragObj[0].ParentId = newParentId;
} else {
return;
}
app.wrapper.save(dragObj[0],
new mx.rpc.Responder(
function():void {
refreshData();
},
function():void{_status = "apex error!";}
)
);
}
我可以访问我正在拖动的数据(因此更改parentId),但不能访问currentTarget。我认为分层数据是问题的一部分,但我在文档中找不到太多内容?有什么想法吗?
So this is driving me crazy. I've got an advanced data grid with a dataprovider that's an array collection w/ hierarchical data. Each object (including the children) has an id field. I'm trying to drag and drop data from within the ADG. When this happens, I need to grab the id off the drop target and change the dragged object's parentid field. Here's what I've got:
public function topAccountsGrid_dragDropHandler(event:DragEvent):void{
//In this function, you need to make the move, update the field in salesforce, and refresh the salesforce data...
if(checkActivateAccountManageMode.selected == true) {
var dragObj:Array = event.dragSource.dataForFormat("treeDataGridItems") as Array;
var newParentId:String = event.currentTarget['Id'];
dragObj[0].ParentId = newParentId;
} else {
return;
}
app.wrapper.save(dragObj[0],
new mx.rpc.Responder(
function():void {
refreshData();
},
function():void{_status = "apex error!";}
)
);
}
I can access the data I'm draggin (hence changing parentId) but not the currentTarget. I think the hierarchical data is part of the problem, but I can't find much in the documentation? Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
event.currentTarget
不是节点,它是 ADG 本身。但是,获取所需信息非常容易,因为 ADG 在内部存储该数据(作为mx_internal
)。我在
dragOver
处理程序中使用以下代码片段(使用 Flex SDK 4.1 进行测试),但我想它也可以在dragDrop
处理程序中工作。event.currentTarget
is not a node, it's the ADG itself. However, it's quite easy to get the information you want, since the ADG stores that data internally (asmx_internal
).I'm using the following code snippets (tested with Flex SDK 4.1) in a
dragOver
handler, but I guess it will work in adragDrop
handler too.应该
试试这个。
should be
Try this.