unbindAll example


HTML document 

<html>

<head>
<title>example</title>
<SCRIPT>
function unbindBranches() {
 var diputree = parent.frames["diputree"].document.diputree;

 var docElement = "#/1";
 var branches = "#xpointer(has/b)";

 diputree.unbindAll (docElement, branches);

 diputree.refresh(100);
}

function unbindLeafs() {
 var diputree = parent.frames["diputree"].document.diputree;

 var docElement = "#/1";
 var leafs = "#xpointer(has/l)";

 diputree.unbindAll (docElement, leafs);

 diputree.refresh(100);
}
</SCRIPT>
</head>

<body>

<form>
<p>Unbind all branches:
<p><input type="button" value="unbind" onClick="unbindBranches();">

<p>Unbind all leafs:
<p><input type="button" value="unbind" onClick="unbindLeafs();">

</form>

</body>
</html>

Explanation

Set up xpointer for all branches.

 var docElement = "#/1";
 var leafs = "#xpointer(has/l)";

Call the unbindAll method to delete all branches.

 diputree.unbindAll (docElement, branches);

Set up xpointer for all leafs.

 var docElement = "#/1";
 var leafs = "#xpointer(has/l)";

Call the unbindAll method to delete all branches.

 diputree.unbindAll (docElement, leafs);


diputree documentation © 2000 dipu