Q:

jsTree - Setting href attributes in Json data

Im trying to create a 'jsTree' treeview that gets it's data from a .Net webservice.
Everything is working, except for the a-node's href attribute. Whatever I try, it always renders as '#'.
As I understand from the documentation, all attributes in any data object get copied to the  a-node.
Below is an example of my current json object. Can anyway figure out why the href attribute isn't copied to the nodes?
    [ { "attributes" : { "id" : "rootnode_2",
        "rel" : "root2"
      },
    "children" : [ { "attributes" : { "id" : "childnode_9",
              "rel" : "folder"
            },
          "children" : [ { "attributes" : { "id" : "childnode_23",
                    "rel" : "folder"
                  },
                "children" : null,
                "data" : { "href" : "http://www.google.com",
                    "title" : "Test_Below_1"
                  },
                "state" : null
              } ],
          "data" : { "href" : "http://www.google.com",
              "title" : "Test_1"
            },
          "state" : null
        },
        { "attributes" : { "id" : "childnode_10",
              "rel" : "folder"
            },
          "children" : [ { "attributes" : { "id" : "childnode_24",
                    "rel" : "folder"
                  },
                "children" : null,
                "data" : { "href" : "http://www.google.com",
                    "title" : "Test_Below_2"
                  },
                "state" : null
              } ],
          "data" : { "href" : "http://www.google.com",
              "title" : "Test_2"
            },
          "state" : null
        }
      ],
    "data" : { "href" : "http://www.google.com",
        "title" : "Glatt"
      },
    "state" : "closed"
  } ]

This is how I initialize the tree;
$("#jstreejson").jstree({
        json_data : {
            "data": treeObject
        },
        themes: {
            "theme": "apple",
            "dots": true,
            "icons": true,
            "url": "/Scripts/themes/apple/style.css"
        },
        plugins: ['core', 'themes', 'json', "json_data"]
    });

A:

So... I'm not sure that's entirely correct. You can't control the anchor attributes as far as I know, but what you can do add stuff to the attr hash in the json and then use the select_node.jstree event to open the desired link, i.e:
.bind("select_node.jstree", function (e,data) {
   var href_address = data.rslt.obj.attr("whatever");
   // open desired link
}

