Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6182009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:07:41+00:00 2026-05-24T01:07:41+00:00

This is a two-parter question here. The first is a technical question about how

  • 0

This is a two-parter question here. The first is a technical question about how Sencha parses JSON and reads stores.

I have two models, Order and User:

Ext.regModel('Order', {
  fields: [
    {name: 'id', type: 'int'},
    {name: 'user_id', type: 'int'},
    {name: 'name', type: 'string'},
    {name: 'price', type: 'float'},
  ],
  belongsTo: 'User'
});

Ext.regModel('User',{
  fields: [
    {name: 'id', type: 'int'},
    {name: 'first_name', type: 'string'},
    {name: 'last_name', type: 'string'},
    {name: 'email', type: 'string'},
  ],
  associations:[
    {type: 'hasMany', model: 'Order', name: 'orders'}
  ]
});

Overall, a pretty simple association. I have the following JSON that is retrieved from the server:

[
  {
    "id":22,
    "price":0.0,
    "name":"My First Order",
    "user_id":3,
    "user": {
      "id": 3,
      "first_name": "Michael",
      "last_name": "Jones",
      "email": "michaeljones@email.com"
    }
  }
]

Lastly, here is my store:

var o = new Ext.data.Store({
    model: "Order",
    sorters: "name",
    getGroupString: function(record){
        return record.get('name')[0]
    },
    proxy: {
        type: 'ajax',
        url: '/orders',
            headers: {'Accept': 'application/json'},
            reader: {
             type: 'json'
            }
    },
    autoLoad: true
});

Ext.regStore("Orders",o);

When I read the order data, I can’t find any mention of the user. So, then I found this handy guide in the Sencha documentation: http://dev.sencha.com/deploy/touch/docs/?class=Ext.data.Reader

However the documentation only shows an example for a hasMany association – it doesn’t include one pulling data from a belongsTo association. I tried scouring the internet for a couple hours and came up empty-handed. What is the proper way to retrieve the user field from an order field?

UPDATE: I removed the proxy and autoLoad parameters in my store and replaced it with a data parameter, which contained the same exact string of JSON returned by my server in my example. And guess what? It worked. However, I still need to fix this problem so that it will work when communicating with my server! Any ideas?

And the second part: What are your thoughts about Sencha Touch? The framework seems very powerful, but the documentation and examples seem rather weak. I’m also concerned by how difficult parsing this data has become. Are there better alternatives out there?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:07:42+00:00Added an answer on May 24, 2026 at 1:07 am

    I am rather new to Sencha as well and can’t answer your question per se, but since you say it works when you load the data directly, a work-around could be to get the JSON object with a plain Ext.Ajax.request() and then use o.loadData(theData).

    Also, have you seen this http://dev.sencha.com/deploy/touch/docs/?class=Ext.data.BelongsToAssociation?

    As to your second question, Sencha’s documentation obviously could be better, but compared to the usual shit you get with API’s I think it is actually quite good – finding obscure config options is something you will have to do no matter what framework you choose.

    I have really liked it’s style + animations; there is nothing out there that I know of that has the same level of “wow-factor”; I think this is worth perhaps writing your own data parser if you don’t find an elegant solution. Customers don’t buy/use products because the code is elegant or the data structures are especially robust; they buy them because they are snazzy or presented using a snazzy app.

    The SASS+Compass integration also makes custom styling it so much easier than normal CSS.

    Finally, I don’t know if you need this, but I have been using the alpha of Sencha’s “TouchCharts” (to be released in the next few months I think), and it is very impressive; animated charts (easing), interaction with data series (item tap, compare items, zoom), and the charts auto-update like dataviews.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is a bit of a two-parter. First, the title question. Here's what
This is a two part question. A dumb technical query and a broader query
This is actually a two part question. First,does the HttpContext.Current correspond to the current
The scenario is this We have two applications A and B, both which are
First, two examples: // This works int foo = 43; long lFoo = foo;
This question has been discussed in two blog posts ( http://dow.ngra.de/2008/10/27/when-systemcurrenttimemillis-is-too-slow/ , http://dow.ngra.de/2008/10/28/what-do-we-really-know-about-non-blocking-concurrency-in-java/ ),
This is on the Mac: If I have two filenames /foo/foo and /foo/FOO they
This is my second question about this topic, the original question can be found
There are a lot of posts on here about this, I'm using this code
My question is about memory use and objects in actionscript 2. If I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.