用delete删除XML和XMLListCollection的节点
2010-09-15 14:24
260 查看
Problem Summary
simply using the Delete key work in Flex does not work most of the time and if you have a Tree that's bound to the XMLListCollection Flex will mess up the Tree Selection after deleting an XML element.Solution Summary
Use a custom method to for loop and delete proper child and reset tree selectionExplanation
Use this method:private function xmlDeleteNode(xmlToDelete:XML):Boolean
{
var cn:XMLList = XMLList(xmlToDelete.parent()).children();
for ( var i:Number = 0 ; i < cn.length() ; i++ )
{
if ( cn[i] == xmlToDelete )
{
delete cn[i];
return true;
}
}
return false;
}
Also, remember to do on an XML Bound Tree Control:
myTree.selectedItem = null;
注:XMLList 不支持 delete
相关文章推荐
- LeetCode 237. Delete Node in a Linked List(删除链表中的一个节点)
- lintcode 容易题:Delete Node in the Middle of Singly Linked List 在O(1)时间复杂度删除链表节点
- LeetCode 237 Delete Node in a Linked List(在链表中删除节点)
- LeetCode 237. Delete Node in a Linked List - 删除链表中的一个节点
- [LintCode] Delete Node in the Middle of Singly Linked List 在单链表的中间删除节点
- Delete Node in a Linked List(删除链表中的节点)
- [LeetCode]79. Delete Node in a Linked List删除链表节点
- LeetCode237_Delete Node in a Linked List(删除链表中的节点) Java题解
- LeetCode--Delete Node in a Linked List(删除链表中的节点)Python
- 372. 在O(1)时间复杂度删除链表节点 (delete-node-in-the-middle-of-singly-linked-list)(c++)----lintcode面试题之链表
- 237. Delete Node in a Linked List | 删除单链表的节点
- LintCode Delete Node in the Middle of Singly Linked List 在O(1)时间复杂度删除链表节点
- [LeetCode] 237. Delete Node in a Linked List 删除链表的节点
- [CareerCup] 2.3 Delete Node in a Linked List 删除链表的节点
- [LeetCode] Delete Node in a Linked List 删除链表的节点
- 237. Delete Node in a Linked List (删除单链表中的指定节点)
- Delete Node in a Linked List 删除链表的节点
- Delete Node in a Linked List 删除链表的一个节点
- leetcode 237 --Delete Node in a Linked List 链表 删除节点
- leetcode237---Delete Node in a Linked List(删除指定节点)