View Full Version : What's the difference between model and store?

1 Sep 2012, 7:06 PM
I'm new to ExtJS. I wonder what the difference between model and store is.
When to use model, and when to use store?
I thought the model is the schema, and the store is the data itself.
But it seems not a right concept...

1 Sep 2012, 8:18 PM
Using SQL terminology:

A model is like a schema.

An instance of a model (record) is like a row.

A store is like a table.

2 Sep 2012, 11:26 PM
That's it.
You have to see the store as a collection of data resulting from a specific query, while the model will be the definition of your data fields types

3 Sep 2012, 12:39 AM
A model contains:

field definitions
associations - allowing you to associate other data stores with this model
proxy - to get your data to-from localstorage or server

Can be used without a store for instance to load and save a form with a single record.

A store contains:

sorters - to sort your data
filters - to sort your data
group-ers - to group your data

Used for grids, XTemplate generated views, charts and other visualisations.

** note you can also put fields: and data:[] and proxy into a store and have it configured inline so no need for a model, but this is usually not used...

why not go to the fast track course and get up to speed in a week! ;-)

more info: