Results 1 to 1 of 1

Thread: Ext.data.JsonStore mapping problem

  1. #1
    Ext JS Premium Member
    Join Date
    Sep 2010
    Posts
    1

    Question Ext.data.JsonStore mapping problem

    I'm playing around with ExtJS using a JSON API provided by an existing application. I am unable to map to deeper values in my JSON object.

    When my mapping contains:

    Code:
    {name:"target", mapping:"fields.target.fields.name"}
    No data is rendered in my GridPanel. No error is generated either. If I change it to:

    Code:
    {name:"target", mapping:"fields.target"}
    My GridPanel renders correctly (with "Object" in the target column).

    /analyzer/projects.json returns something along the lines of:

    Code:
    {"result":"ok","messages":[],"start":0,"perpage":15,"order_by":"submitted","sort":"desc","total":472,"data":[
        {
            "pk": 494, 
            "model": "analyzer.project", 
            "fields": {
                "requested_by": {
                    "pk": 1, 
                    "model": "auth.user", 
                    "fields": {
                        "username": "itodd"
                    }
                }
                "description": "testing lambda", 
                "lc_fasta_file": "uploads/2010/09/23/lambda-test-set-1_lc.fasta", 
                "target": {
                    "pk": 1, 
                    "model": "analyzer.target", 
                    "fields": {
                        "name": "ACK01"
                    }
                }, 
                "submitted": "2010-09-23 10:56:09", 
                "processed": "2010-09-23 10:57:22", 
            }
        },
    
     ...
    
    }
    Is it possible to map to fields.target.fields.name?

    Edit: From the API docs, it sounds like my attempt should work.

    "The mapping is a string containing the javascript expression to reference the data from an element of the data item's root Array. Defaults to the field name."
    Last edited by itodd; 23 Sep 2010 at 8:03 AM. Reason: Added API info.

Similar Threads

  1. Problem with mapping in JsonStore
    By gadus in forum Ext 3.x: Help & Discussion
    Replies: 7
    Last Post: 4 Oct 2011, 1:58 PM
  2. Problem with Ext.data.JsonStore
    By [email protected] in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 1 Sep 2010, 2:00 AM
  3. Nested JSON data and JsonStore mapping question
    By xsikal in forum Ext 3.x: Help & Discussion
    Replies: 8
    Last Post: 18 Jun 2010, 7:30 AM
  4. problem with Ext.data.JsonStore
    By stetou in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 8 Oct 2009, 9:55 AM
  5. Ext.data.JsonStore & Ext.form.ComboBox Problem??help
    By SnigRO in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 4 Sep 2008, 10:32 PM

Tags for this Thread

Posting Permissions

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