Results 1 to 3 of 3

Thread: How to get keys out of JSON and build an grid

  1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    20
    Vote Rating
    0
      0  

    Default How to get keys out of JSON and build an grid

    Hi @all
    my actual problem is following.
    I use an formpanel to submit some data to the server, something like an search function with combos and checkboxes. Server returns me an JSON with results. Depence of the data in the JSON I have to build an grid for this data. The point is that I don`t know how many columns the grid should have.

    How can I access the JSON und run through to generate the grid. something like for each where I make every key to an column.
    If you have any links which could help me out it would be great.

    thx in advance
    greets streha

    EDIT
    I switch to an other solution. I provide all necsessery data throu the json so the serverside script decides about everything.

  2. #2
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    27
    Vote Rating
    0
      0  

    Default

    Do you get any idea about how to get keys from json.Is there any possibilty to get the keys out?


    Thanks

    Gayathri

  3. #3
    Sencha User
    Join Date
    Aug 2009
    Posts
    480
    Vote Rating
    3
      0  

    Default

    You just have to parse the JSON and once you have a native JS object, you use a for in loop.

    Code:
    for (var key in obj) { console.log(key); }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •