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 7499397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:48:51+00:00 2026-05-29T19:48:51+00:00

For example I have 2 models: Ext.define(‘Order’, { extend : ‘Ext.data.Model’, fields : [

  • 0

For example I have 2 models:

Ext.define('Order', {
    extend   : 'Ext.data.Model',
    fields   : [
            {name : 'id',          type : 'int'},
            {name : 'customer_id', type : 'int'},
            {name : 'date',        type : 'date'}
    ],
    hasMany: [{model: 'Product', name: 'Products'}]
});

Ext.define('Product', {
    extend   : 'Ext.data.Model',
    fields   : [
            {name : 'id',          type : 'int'},
            {name : 'name',        type : 'string'},
            {name : 'description', type : 'string'},
            {name : 'price',       type : 'float'}
    ],
    belongsTo: 'Order'
});

these models displayed in 2 grids. Then when changes made I need post them to server. But the trick in I need post both model in one request, e.g.:

{"order":{"id":1, "date":'2011.09.01', "Products": [{"id":1, "name":"product name", ... }]}}

In this way I think both grids should use one Store and before write store in must be filled with grid changes ( maybe some internal stores without ability to write to server ).

How to implement it ? Any ideas ?

  • 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-29T19:48:52+00:00Added an answer on May 29, 2026 at 7:48 pm

    The solution is store data in memory and on Save fill synced store manually and call Save method:

    Ext.define('OrderStore', {
        extend: 'Ext.data.Store',
    
        storeId: 'orderStore',
        proxy: {
            type: 'ajax',
            api: {
                read: 'Order/Load',
                create: 'Order/Add',
                update: 'Order/Update',
                destroy: 'Order/Delete'
            },
            reader: {
                type: 'json',
                root: 'orders',
                totalProperty: 'total',
                messageProperty: 'message',
                successProperty: 'success'
            },
            writer: {
                type: 'json',
                listful: true,
                writeAllFields: true,
                        getRecordData: function (record) { return record.data; },
                root: 'order',
                allowSingle: true
            },
            headers: { 'Content-Type': 'application/json; charset=UTF-8' }
        },
        autoLoad: true,
        listeners: {
            // commit changes
            write: function (store, operation, eOpts ) {
                var orderItemsStore = OrderEdit.store;
                orderItemsStore.each( function (item) {
                    item.commit();
                });
    
                // ...
            }
        }
    });
    

    where:

    Ext.define('OrderEdit', {
        // ...
        orderStore: Ext.create('OrderStore', {model: 'Order', owner: this}),
        store: Ext.create('OrderItemStore')
    

    and

    Ext.define('OrderItemStore', {
        extend: 'Ext.data.Store',
    
        model: 'Order',
        proxy: {
            type: 'memory'
        }
    });
    

    and then save changes:

    saveButtonClick: function (button) {
        var order = OrderEdit.orderStore.getRange()[0];
        res = order.data;
        res.Items = [];
        OrderEdit.store.each(function (record, index) {
                res.Items[index] = record.data;
        });
        // ...
    
        OrderEdit.orderStore.removeAll();
        OrderEdit.orderStore.add(res);
        OrderEdit.orderStore.save();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my model: Ext.define('A.model.Group', { extend: 'Ext.data.Model', fields:['id', 'name'], proxy: { type: 'rest',
I have models (simplified example): class Group(models.Model): name = models.CharField(max_length = 32) class Person(models.Model):
According to an example , I have three models: class User(models.Model): name = models.CharField(max_length=128)
I have a model: class Example(models.Model): unique_hash = models.CharField(max_length=32,unique=True) content = models.FileField(upload_to='source',blank=True,verbose_name=HTML Content File)
I have a model defined as below: class Example(models.Model): user = models.ForeignKey(User, null=True) other
For example I have in my app model User, that has_many models Post. And
Often during writing JavaScript, we have to write configuration object. For example Ext.define('User', {
Let's say I have a Sencha Touch model like this: Ext.regModel('User', { 'fields': [{
For example I have a comments models, and I have a post model, but
I have a few model classes with basic one-to-many relationships. For example, a book

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.