1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    65
    Vote Rating
    0
    thameema is on a distinguished road

      0  

    Default TreePanel - JSON leaf value with quotes (not boolean) issue

    TreePanel - JSON leaf value with quotes (not boolean) issue


    Hello all,
    This must be micro bug in TreePanel but its causing issues.
    I am returning a JSON data to TreeLoader to TreePanel which contains "leaf":"false" which suppose to render the tree element as "folder" but because of double quotes around "false" its not taking the value. If i remove the quotes (ie, "leaf":false) it works. I searched this forum for specific issues and no one reported this as issue. Anyone facing same issue???

    I am using json.org java libraries to create the JSON object.

    Thanks,
    Thameem

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,505
    Vote Rating
    52
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Surely that's expected. The property is being set to a string. An if test on a non-empty string is true.

  3. #3
    Ext Premium Member BernardChhun's Avatar
    Join Date
    Mar 2007
    Location
    Quebec, Canada
    Posts
    831
    Vote Rating
    2
    BernardChhun will become famous soon enough

      0  

    Default


    how would you interpret a true or false sentence with double quotes...?

    the TreeNode's leaf attribute takes a boolean...not a string who could be interpreted as a boolean with quotes.

  4. #4
    Ext User
    Join Date
    Mar 2007
    Posts
    65
    Vote Rating
    0
    thameema is on a distinguished road

      0  

    Default


    My question is, as per JSON notation everything should be a string...So, the json.org json library is returning that as string... I am not sure how to handle this??? or is that to be fixed in the yui-ext tree code?

  5. #5
    Ext Premium Member BernardChhun's Avatar
    Join Date
    Mar 2007
    Location
    Quebec, Canada
    Posts
    831
    Vote Rating
    2
    BernardChhun will become famous soon enough

      0  

    Default


    Quote Originally Posted by thameema
    My question is, as per JSON notation everything should be a string...So, the json.org json library is returning that as string... I am not sure how to handle this??? or is that to be fixed in the yui-ext tree code?
    really? I'm not even using that library...
    here's what I get for a TreeNode using python's JSON encoder:
    Code:
    {"text": "Appartement-Condominium", "leaf": true, "id": "genres/residentiel/0101"}
    you could hack it yourself in yui-ext...but it might take a while to find out where to do it so for now I'd hack your json library if I were you.

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,505
    Vote Rating
    52
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    @thameema:

    I don't think that's valid.

    To my mind "Javascript Object Notation" is javascript syntax. It's the javascript source representation of an object. So a quoted string is a quoted string. Regardless of what it contains.

    { foo: "1" }

    Means that the foo property is a string, and not a number.

  7. #7
    Ext User
    Join Date
    Mar 2007
    Posts
    65
    Vote Rating
    0
    thameema is on a distinguished road

      0  

    Default


    I was wrong. It was caused by the apache commons BeanUtils class which I use to convert a bean to a map then creating the JSONObject. So, that conversion is making everything to String eventhough i set the value as boolean in my bean. Now i hacked that part and everything works.

    Thanks,
    Thameem

Similar Threads

  1. TreePanel and JSON TreeLoader Problem (new nodes invisible)
    By sjanes71 in forum Ext 2.x: Help & Discussion
    Replies: 32
    Last Post: 11 May 2007, 6:55 AM
  2. Regex Strings with Quotes
    By fuzzymonk in forum Sencha Cmd
    Replies: 0
    Last Post: 8 Mar 2007, 6:19 AM
  3. TreePanel, FireFox, using Shift or Ctrl Issue
    By mikegiddens in forum Ext 1.x: Bugs
    Replies: 1
    Last Post: 22 Jan 2007, 12:10 AM
  4. Tree folder becomes leaf
    By seldon in forum Ext 1.x: Help & Discussion
    Replies: 6
    Last Post: 6 Jan 2007, 4:38 PM
  5. Boolean Fields Not Working in Inline Editor Grid
    By kyahne in forum Ext 1.x: Bugs
    Replies: 2
    Last Post: 5 Dec 2006, 1:26 AM

Thread Participants: 2