Sochettra / dynatree

Automatically exported from code.google.com/p/dynatree
0 stars 0 forks source link

Persistence by URL location #194

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What new or enhanced feature are you proposing?

Persistence by current url, something similar to the location persistence in 
Treeview (jquery tree plugin).

What goal would this enhancement help you achieve?

I need this functionality for my project.

Original issue reported on code.google.com by yugen...@gmail.com on 22 Apr 2011 at 4:03

GoogleCodeExporter commented 8 years ago

Original comment by moo...@wwwendt.de on 25 Apr 2011 at 9:05

GoogleCodeExporter commented 8 years ago
I guess this feature can already be realized using available techniques:

1. Add ahelper function to parse the URL:

    function getURLParameter(name) {
        return unescape(
            (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
        );
    }

2. Evaluate the URL after the tree was loaded:

    $(function(){
        $("#tree").dynatree({
            [...]
            onPostInit: function(isReloading, isError) {
                var key = getURLParameter("activate");
                if( key ) {
                    this.activateKey(key);
                }
            },

3. Add the node key to the URL:

    http://server/_test-194.html?activate=_11

Original comment by moo...@wwwendt.de on 25 Apr 2011 at 3:56