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

40282Re: [ydn-javascript] Is it possible to setup TreeView to keep it's state?

Expand Messages
  • Lee.M
    Nov 2, 2008
    • 0 Attachment
      On Nov 2, 2008, at 1:53 AM, Satyam wrote:

      > Cookies have to be strings or things that have string representations.
      > The string representation of an object is "[object]"which is not very
      > useful.
      >
      > You have to use the JSON utility to convert the tree definition to a
      > string and store that string into the cookie. On the way back, you
      > read
      > the cookie, parse it with the JSON utility and use that as the second
      > argument to the TreeView constructor.
      >

      Thanks again :) I had also tried that but this is the result:

      All of this is in <head> along with the treeview and cookie .js's:

      <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo/yahoo-min.js
      "></script>
      <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/json/json-min.js
      "></script>
      ...
      var tree_struct_x = tree.getTreeDefinition;
      alert(tree_struct_x);
      var tree_data_string_x =
      YAHOO.lang.JSON.stringify(tree_struct_x);
      alert(tree_data_string_x);
      ...

      1st alert is:
      function ()
      {
      return this.getRoot().getNodeDefinition();
      }

      2nd one is:
      undefined

      Seems om as per: http://developer.yahoo.com/yui/json/#stringify

      What am I doing wrong ?

      TIA!

      Lee.M
    • Show all 21 messages in this topic