Removing Natural Order Sorting

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Removing Natural Order Sorting

Alex Milowski
I've been trying to remove the "natural" order from my trees that
are backed by RDF without any success.  What I tried was removing
the sort attribute on the treecol and then adding a onclick
that called the following javascript:

    toggleSort: function(id,resource) {
       var treecol = document.getElementById(id);
       var direction = treecol.getAttribute("sortDirection");
       var current = treecol.parentNode.firstChild;
       while (current) {
          if (current.nodeType==1 && current.localName=="treecol") {
             current.removeAttribute("sortDirection");
          }
          current = current.nextSibling;
       }
       if (direction=="ascending") {
          direction = "descending";
          treecol.setAttribute("sortDirection",direction);
       } else {
          direction = "ascending";
          treecol.setAttribute("sortDirection",direction);
       }
       var sortService =
Components.classes["@mozilla.org/xul/xul-sort-service;1"].getService();
       sortSerivce =
sortService.QueryInterface(Components.interfaces.nsIXULSortService);
       sortService.sort(treecol, resource, direction);
       treecol.parentNode.parentNode.builder.rebuild();
    }

The 'id' parameter is the id of the treecol element I want to
sort and the 'resource' parameter is the RDF property I want
to sort upon.

Not only does it not work correctly, but that last line causes
the browser to crash:

    treecol.parentNode.parentNode.builder.rebuild();

If I put an "alert" call right before that line, the browser does
not crash.

--Alex Milowski
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf