Loading ...
Sorry, an error occurred while loading the content.

Re: Multiple TreeViews Based on Different Stylesheets

Expand Messages
  • Mike Watts
    Here s the solution I came up with to show multiple TreeViews on the same page using different stylesheets: /** * Construct the multi tree * * @parm
    Message 1 of 3 , Jul 6, 2006
    • 0 Attachment
      Here's the solution I came up with to show multiple TreeViews on the same page using different stylesheets:
      /**
       * Construct the multi tree
       *
       * @parm {string} id the id of the element that will hold the tree
       * @parm {string} stylesheet class prefix
       * @private
       */
      FL.util.MultiTreeView = function(id, prefix) {
        if (id) {
          this.init(id);
        }
        
        if (prefix) {
          this.prefix = prefix;
        }
      };
      
      FL.util.MultiTreeView.prototype = new YAHOO.widget.TreeView();
      
      /**
       * A style class prefix for node toggle states.
       *
       * @type string
       */
      FL.util.MultiTreeView.prototype.prefix = "";
      
      
      FL.util.MultiTextNode = function(oData, oParent, expanded) {
        this.type = "TextNode";
      
        if (oParent) {
          this.init(oData, oParent, expanded);
          this.setUpLabel(oData);
        }
      };
      
      FL.util.MultiTextNode.prototype = new YAHOO.widget.TextNode();
      
      /**
       * Returns the css style name for the toggle
       *
       * @return {string} the css class for this node's toggle
       */
      FL.util.MultiTextNode.prototype.getStyle = function() {
        if (this.isLoading) {
          return "ygtvloading";
        }
        else {
          // location top or bottom, middle nodes also get the top style
          var loc = (this.nextSibling) ? "t" : "l";
          // type p=plus(expand), m=minus(collapase), n=none(no children)
          var type = "n";
          if (this.hasChildren(true) || (this.isDynamic()  !this.getIconMode())) {
            // if (this.hasChildren(true)) {
            type = (this.expanded) ? "m" : "p";
          }
          
          if (this.tree.prefix) {
            return this.tree.prefix + "ygtv" + loc + type;
          }
          else {
            return "ygtv" + loc + type;
          }
        }
      };
      

      --- In ydn-javascript@yahoogroups.com, "Mike Watts" <mikwat@...> wrote:
      >
      > I need to render two TreeViews based on different stylesheets on the
      > same page. This doesn't appear to be possible. It would be nice if
      > you could specify a style class name prefix when creating each tree.
      > Does anyone have a suggestion or work-around for this?
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.