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

  • Home
  • SEARCH
  • 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 4558626
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:40:30+00:00 2026-05-21T17:40:30+00:00

i am working with Ext JS & Rails as backend..i am having myysql database

  • 0

i am working with Ext JS & Rails as backend..i am having myysql database that has parent-child relationship i.e. 1-to-many relationship…I want a “single” JSON store that can be used to load “GRID” data with parent & child records..
Also is there any way to bind both – the form as well as the grid to the same store but having different jsonreaders? i.e. form’s datareader would read the string with root: ‘customers’ and grid will read the string with root :’products’?
The JSON looks like this :

{
        "customers": [{
            "amt": 8000,
            "custnm": "rashmi",
            "id": 2,
            "purdt": "2011-04-27",
            "products": [{
                "amt": 40,
                "customer_id": 2,
                "id": 3,
                "prodnm": "oil",
                "qty": 1,
                "rate": 40
            }]
        }, {
            "amt": 300000,
            "custnm": "bhumika",
            "id": 3,
            "purdt": "2011-04-14",
            "products": [{
                "amt": 40,
                "customer_id": 3,
                "id": 1,
                "prodnm": "soap",
                "qty": 20000,
                "rate": 20
            }, {
                "amt": 150,
                "customer_id": 3,
                "id": 2,
                "prodnm": "shampoo",
                "qty": 3000,
                "rate": 50
            }, {
                "amt": null,
                "customer_id": 3,
                "id": 14,
                "prodnm": "aa",
                "qty": 2,
                "rate": null
            }]
        }, {
            "amt": 15000,
            "custnm": "Shruti",
            "id": 13,
            "purdt": "2011-04-08",
            "products": []
        }, {
            "amt": 200000,
            "custnm": "Jayesh",
            "id": 14,
            "purdt": "2011-03-31",
            "products": []
        }, {
            "amt": 220000,
            "custnm": "SHRUTI",
            "id": 15,
            "purdt": "2011-04-06",
            "products": []
        }, {
            "amt": 10000,
            "custnm": "RASHMI",
            "id": 24,
            "purdt": "2011-04-06",
            "products": []
        }],
        "results": 6
    }
  • 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-21T17:40:31+00:00Added an answer on May 21, 2026 at 5:40 pm

    The new Ext JS 4 has Model associations which will solve the problem (http://docs.sencha.com/ext-js/4-0/guide/data)

    // each User hasMany Orders
    Ext.define('User', {
        extend: 'Ext.data.Model',
        fields: ['id', 'name', 'email'],
        proxy : {
            type: 'rest',
            url : '/users',
            reader: 'json'
        },
    
        hasMany: 'Orders'
    });
    
    // each Order belongsTo a User, and hasMany OrderItems
    Ext.define('Order', {
        extend: 'Ext.data.Model',
        fields: ['id', 'user_id', 'status'],
        belongsTo: 'User',
        hasMany: 'OrderItems'
    });
    
    // each OrderItem belongsTo an Order
    Ext.define('OrderItem', {
        extend: 'Ext.data.Model',
        fields: ['id', 'order_id', 'name', 'description', 'price', 'quantity'],
        belongsTo: 'Order'
    });
    

    Calling user.orders() returns a Store configured with the Orders model, because the User model defined an association of hasMany: ‘Orders’.

    User.load(123, {
        success: function(user) {
            //we can iterate over the orders easily using the Associations API
            user.orders().each(function(order) {
                console.log(order.get('status'));
    
                //we can even iterate over each Order's OrderItems:
                order.orderItems().each(function(orderItem) {
                    console.log(orderItem.get('title'));
                });
            });
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am working with Ext JS form submission with Rails as backend.. Everything works
Working with dates in ruby and rails on windows, I'm having problems with pre-epoch
I have a Rails application that has to co-exist with a very old legacy
In an Ext Js-application I am working on I have a formpanel that contains
i am newbie to Ext Js..i am working on ruby on rails... can any1
Working with a SqlCommand in C# I've created a query that contains a IN
Working on a project that parses a log of events, and then updates a
Working with an Oracle 9i database from an ASP.NET 2.0 (VB) application using OLEDB.
I'm working in a database on vb.net with sqlite which hosts a gallery and
I'm working on a graphics application that is using virtual classes fairly extensively. It

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.