XUL is fun, but DAMN there’s not enough doc out there. Coming up with this function took far longer than it should! Other functions I found on the web didn’t work for my case.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var g = {};
g.removeSelectedTreeRows = function(treeID)
{
 var tree = document.getElementById(treeID);
 var rangeCount = tree.view.selection.getRangeCount();
 var start = {};
 var end   = {};
 for (var i=0; i<rangeCount; i++)  
 {  
 tree.view.selection.getRangeAt(i, start, end);
 for (var c=end.value; c>=start.value; c--)  
 {
 tree.view.getItemAtIndex(c).parentNode.removeChild(tree.view.getItemAtIndex(c));
 }
 }
};