Re: A question about rebuild the tree after refresh the rdf datasource!
BenKwan <[email protected]> Sun, 28 Jun 2009 18:45:05 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.rdf |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <f43eb1ae-32c8-41e5-ab66-59a6a20da7b2@k15g2000yqc.googlegroups.com> |
On Jun 26, 7:19=A0pm, Neil Deakin <[email protected]> wrote: > BenKwan wrote: > > 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=3D"1.0"?> <RDF:RDF xmlns:NS1=3D"http://netDisck.desktopx.org/rdf#" xmlns:NC=3D"http://home.netscape.com/NC-rdf#" xmlns:RDF=3D"http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <RDF:Seq RDF:about=3D"http://netDisck.desktopx.org/rdf#LogicalRoot"> <RDF:li RDF:resource=3D"http://netDisck.desktopx.org/rdf#ll"/> <RDF:li RDF:resource=3D"http://netDisck.desktopx.org/rdf#22"/> <RDF:li RDF:resource=3D"http://netDisck.desktopx.org/rdf#33"/> <RDF:li RDF:resource=3D"http://netDisck.desktopx.org/rdf#44"/> <RDF:li RDF:resource=3D"http://netDisck.desktopx.org/rdf#55"/> </RDF:Seq> <RDF:Description RDF:about=3D"http://netDisck.desktopx.org/ rdf#LogicalRoot" NS1:path=3D"/alfresco/webdav/Users/126162/Files/" NS1:id=3D"/alfresco/webdav/Users/126162/Files/" NS1:name=3D"root" NS1:parent=3D""/> <RDF:Description RDF:about=3D"http://netDisck.desktopx.org/rdf#ll" NS1:path=3D"/alfresco/webdav/Users/126162/Files/ll/" NS1:id=3D"/alfresco/webdav/Users/126162/Files/ll/" NS1:name=3D"ll" NS1:parent=3D"" /> <RDF:Description RDF:about=3D"http://netDisck.desktopx.org/rdf#22" NS1:path=3D"/alfresco/webdav/Users/126162/Files/ll/" NS1:id=3D"/alfresco/webdav/Users/126162/Files/ll/" NS1:name=3D"22" NS1:parent=3D"" /> <RDF:Description RDF:about=3D"http://netDisck.desktopx.org/rdf#33" NS1:path=3D"/alfresco/webdav/Users/126162/Files/ll/" NS1:id=3D"/alfresco/webdav/Users/126162/Files/ll/" NS1:name=3D"33" NS1:parent=3D"" /> <RDF:Description RDF:about=3D"http://netDisck.desktopx.org/rdf#44" NS1:path=3D"/alfresco/webdav/Users/126162/Files/ll/" NS1:id=3D"/alfresco/webdav/Users/126162/Files/ll/" NS1:name=3D"44" NS1:parent=3D"" /> <RDF:Description RDF:about=3D"http://netDisck.desktopx.org/rdf#55" NS1:path=3D"/alfresco/webdav/Users/126162/Files/ll/" NS1:id=3D"/alfresco/webdav/Users/126162/Files/ll/" NS1:name=3D"55" NS1:parent=3D"" /> </RDF:RDF> my tree: <tree id=3D"root-tree" flex=3D"1" context=3D"clipmenu" datasources=3D"netDisckSource.rdf" ref=3D"http://netDisck.desktopx.org/ rdf#root" > when i delete <RDF:li RDF:resource=3D"http://netDisck.desktopx.org/ rdf#55"/> and <RDF:Description RDF:about=3D"http://netDisck.desktopx.org/ rdf#55" from the rdf file.my refresh js code is : function refresh() { var RDF =3D Components.classes["@mozilla.org/rdf/rdf-service; 1"].getService(Components.interfaces.nsIRDFService); var ds =3D 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=3D"http://netDisck.desktopx.org/rdf#66"/> and <RDF:Description RDF:about=3D"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 =3D document.getElementById("root-tree"); tree.builder.rebuild();" the tree display all right,too! This is the situation i meet.