Edit: I realized that "cookieOptions" is actually a version 1.4.1 feature, only available from the SVN. The feature has not yet been added to the minified version, so you need to grab the uncompressed version here:
http://dev.jquery.com/browser/trunk/plugins/treeview/jquery.treeview.js So it's not undocumented, it's just that 1.4.1 hasn't officially been released yet. On Jul 16, 8:45 am, "Matt B." <[email protected]> wrote: > I just thought I'd post a solution I came up with that may be helpful > to anyone using thetreeviewplugin fornavigation. > > The problem I ran into was that the cookie persistence was working, > but since I was using the tree fornavigationto different directories > of my site, sometimes the cookie wouldn't get set correctly and the > state of the tree would end up being one step behind what the user had > just clicked -- so the previously clicked node would be expanded > rather than the current one. > > Thanks to some helpful posts I found on here, I discovered that the > problem was the cookie path. > > The solution is to use an (undocumented) option that was added to the > plugin as of version 1.4: 'cookieOptions', which lets you set the > cookie path. > > If yournavigationtree could potentially be used for any page in your > domain, then you would set the cookie path to the root, like this: > > cookieOptions: {path: '/'} > > ..or if your site is in a subdirectory you should use this: > cookieOptions: {path: '/my_subdirectory/'} > > In my case I'm using PHP and I have my site root stored in a constant > called WEB_ROOT, so my full code was: > > $(document).ready(function() { > $("#sideNav ul").treeview({ > collapsed: true, > unique: true, > persist: "cookie", > cookieOptions: {path: '<?= WEB_ROOT ?>'} > }); > }); > > Hope this is helpful to somebody.

