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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:18:52+00:00 2026-05-25T14:18:52+00:00

I’ve been trying to learn to work with Models and Stores. But the proxy

  • 0

I’ve been trying to learn to work with Models and Stores. But the proxy bit is confusing me a lot. So I’m going to list out my understanding here – please point out the gaps in my understanding.

My understanding

  1. Models are used to represent domain objects.
  2. Models can be created by ModelManager, or by simply using the constructor
  3. Models are saved in Stores
  4. Stores may be in memory stores, or can be server stores. This is configured using Proxy.
  5. Proxy tells the store how to talk to a backing store – be that a JSON array, or a REST resource, or a simply configured URL via ajax.
  6. Stores are responsible for storing models, and Proxies are responsible for controlling/helping with that task.
  7. When a model’s values are changed, its dirty flag gets set. It gets automatically cleared when the model is saved. (more in this later)

The part that confuses me

  1. Why is there a proxy config and save method on Model? I understand that models can only be stored on to stores.
  2. Why is the dirty flag not cleared simply when I add a model object to a store?
  3. When I add a model object to a store, why does the model not acquire the proxy configured with that store?
  4. proxy is a static configuration for a Model. Does that mean that we cannot use objects of a particular model with multiple data sources? By extension, does this mean having multiple stores for a single model essentially useless?
  5. When we define a Store, are we defining a class (store-type, if we may call it that), or is it an instance of a store? Reason I ask is when we declare a grid, we simply pass it a store config as store: 'MyApp.store.MyStore' – does the grid instantiate a grid of that type, or is it simply using the store we’ve already instantiated?

Thanks!

PS: +50 bounty to the person who explains all this 🙂 – will offer bounty after those 48 hours are over..

  • 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-25T14:18:52+00:00Added an answer on May 25, 2026 at 2:18 pm

    The docs say:

    A Model represents some object that your application manages.

    A Store is just a collection of Model instances – usually loaded from a server somewhere.


    Models are saved in Stores

    Not only. The Models can be used separately (f.i. for populating forms with data. Check out Ext.form.Panel.loadRecord for more info).

    Why is there a proxy config and save method on Model? I understand that models can only be stored on to stores.

    As I’ve said, not only.

    Why is the dirty flag not cleared simply when I add a model object to a store?

    Why should it? The Record becomes clean only when it gets synchronized with the corresponding record on the server side.

    When I add a model object to a store, why does the model not acquire the proxy configured with that store?

    This is, again, because model can be used without store.

    proxy is a static configuration for a Model. Does that mean that we cannot use objects of a particular model with multiple data sources?

    We cannot use objects of a particular model but we can use one model definition for multiple store. For example:

    Ext.define('MyModel', {
      // ... config
    });
    var store1 = Ext.create('Ext.data.Store', {
      model: 'MyModel',
      // ... config
      proxy: {
        // ...
        // this proxy will be used when store1.sync() and store1.load() are called
      }
      // ...
    });
    // ...
    var storeN = Ext.create('Ext.data.Store', {
      model: 'MyModel',
      // ... config
      proxy: {
        // ...
        // this proxy will be used when storeN.sync() and storeN.load() are called
      }
      // ...
    });
    

    Since store1 and storeN use different proxies, the records, contained by these stores, may be completely different.

    When we define a Store, are we defining a class (store-type, if we may call it that), or is it an instance of a store?

    Yes, when we define a Store, we are defining a class.

    Reason I ask is when we declare a grid, we simply pass it a store config as store: ‘MyApp.store.MyStore’ – does the grid instantiate a grid of that type, or is it simply using the store we’ve already instantiated?

    There are couple of ways to set store config for grid:

    1. store: existingStore,
    2. store: 'someStoresId',
    3. store: 'MyApp.store.MyStore',

    In the first and the second cases existing instances of stores would be used. In the third case newly created instance of 'MyApp.store.MyStore' would be used. So, store: 'MyApp.store.MyStore', is equal to

      var myStore = Ext.create('MyApp.store.MyStore', {});
      // ... 
        // the following - is in a grid's config:
        store: myStore,
    

    UPDATE


    When a model is added to store and then the store’s sync() is called, why is the model’s dirty flag not cleared?

    It should be cleared, unless reader, writer and server response are not set up properly. Check out writer example. There is dirty flag being cleared automaticaly on store’s sync().


    if a model class is not given any proxy at all, why does it track its dirty status?

    To let you know if the record was changed since the creation moment.


    What is achieved by introducing the concept of Models syncing themselves to the server?

    Let’s assume you are creating a widget which contains plain set of inputs. The values for this inputs can be loaded from db (this set of inputs represents one row in db table). And when user changes the inputs’ values data should be sent to the server. This data can be stored in one record.

    So what would you use for this interface: one record or a store with only one record?

    Standalone model – is for widgets that represent one row in db table.
    Store – is for widgets that represent set of rows in db table.

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but

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.