When the change is removing some resources from the rdf file, the tree
rebuild itself after refreshing datasource.But if the change is adding
some resources to the rdf file,the tree does nothing after refreshing
datasource. I have to run these code to rebuild the tree manually:
/////////////////////////////////////
var tree = document.getElementById("root-tree");
tree.rebuild();
/////////////////////////////////////
why the tree doesn't rebuild itself in the second condition!
Hard to tell without seeing what is being changed. If the new data
doesn't relate to what's already in the tree, nothing will happen.
Note that changing the datasource never rebuilds the template. It only
updates the pieces that would need changing.
My RDF file is :
<?xml version="1.0"?>
<RDF:RDF xmlns:NS1="http://netDisck.desktopx.org/rdf#"
xmlns:NC="http://home.netscape.com/NC-rdf#"
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF:Seq RDF:about="http://netDisck.desktopx.org/rdf#LogicalRoot">
<RDF:li RDF:resource="http://netDisck.desktopx.org/rdf#ll"/>
<RDF:li RDF:resource="http://netDisck.desktopx.org/rdf#22"/>
<RDF:li RDF:resource="http://netDisck.desktopx.org/rdf#33"/>
<RDF:li RDF:resource="http://netDisck.desktopx.org/rdf#44"/>
<RDF:li RDF:resource="http://netDisck.desktopx.org/rdf#55"/>
</RDF:Seq>
<RDF:Description RDF:about="http://netDisck.desktopx.org/
rdf#LogicalRoot"
NS1:path="/alfresco/webdav/Users/126162/Files/"
NS1:id="/alfresco/webdav/Users/126162/Files/"
NS1:name="root"
NS1:parent=""/>
<RDF:Description RDF:about="http://netDisck.desktopx.org/rdf#ll"
NS1:path="/alfresco/webdav/Users/126162/Files/ll/"
NS1:id="/alfresco/webdav/Users/126162/Files/ll/"
NS1:name="ll"
NS1:parent="" />
<RDF:Description RDF:about="http://netDisck.desktopx.org/rdf#22"
NS1:path="/alfresco/webdav/Users/126162/Files/ll/"
NS1:id="/alfresco/webdav/Users/126162/Files/ll/"
NS1:name="22"
NS1:parent="" />
<RDF:Description RDF:about="http://netDisck.desktopx.org/rdf#33"
NS1:path="/alfresco/webdav/Users/126162/Files/ll/"
NS1:id="/alfresco/webdav/Users/126162/Files/ll/"
NS1:name="33"
NS1:parent="" />
<RDF:Description RDF:about="http://netDisck.desktopx.org/rdf#44"
NS1:path="/alfresco/webdav/Users/126162/Files/ll/"
NS1:id="/alfresco/webdav/Users/126162/Files/ll/"
NS1:name="44"
NS1:parent="" />
<RDF:Description RDF:about="http://netDisck.desktopx.org/rdf#55"
NS1:path="/alfresco/webdav/Users/126162/Files/ll/"
NS1:id="/alfresco/webdav/Users/126162/Files/ll/"
NS1:name="55"
NS1:parent="" />
</RDF:RDF>
my tree:
<tree id="root-tree" flex="1" context="clipmenu"
datasources="netDisckSource.rdf" ref="http://netDisck.desktopx.org/
rdf#root" >
when i delete <RDF:li RDF:resource="http://netDisck.desktopx.org/
rdf#55"/> and <RDF:Description RDF:about="http://netDisck.desktopx.org/
rdf#55" from the rdf file.my refresh js code is :
function refresh()
{
var RDF = Components.classes["@mozilla.org/rdf/rdf-service;
1"].getService(Components.interfaces.nsIRDFService);
var ds = RDF.GetDataSource("chrome://treeroot/content/
netDisckSource.rdf");
ds.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
ds.Refresh(false);
}
the tree displays all right.the node "55" is remove, and now i add
<RDF:li RDF:resource="http://netDisck.desktopx.org/rdf#66"/> and
<RDF:Description RDF:about="http://netDisck.desktopx.org/rdf#66" to
the rdf file and invoke refresh(),nothing is changed. But if add this
to the end of the refresh() function:
"var tree = document.getElementById("root-tree");
tree.builder.rebuild();"
the tree display all right,too!
This is the situation i meet.