A question about rebuild the tree after refresh the rdf datasourceļ¼
BenKwan <[email protected]> Thu, 25 Jun 2009 19:08:02 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.rdf |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <28ed793d-f4fe-4c84-bfba-801ce4bdf33e@t11g2000prh.googlegroups.com> |
When i use rdf datasources property of tree, a strange question about
rebuilding the tree comes out. I set the datasources property of tree
with a uri of a rdf file(just like chrome://test/content/test.rdf).
this rdf file can be modified in other codes. When the rdf file is
changed(add or remove resources),i run these code:
/////////////////////////////////////
var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
.getService
(Components.interfaces.nsIRDFService);
var ds = RDF.GetDataSource("chrome://test/content/test.rdf");
ds.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
ds.Refresh(false);
/////////////////////////////////////
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!