Search code examples
extjsextjs4

Dirty state in EXTJS


What is Dirty state? why they are using it in grid?

I refered Google but its not clear. Anyone explain me why we are using it in grid.

Ext.define('Ext.mixin.Dirty', {
    mixinId: 'dirty',
config: {
dirty: null
    },
 dirty: false, 
@property
@private
 @readonly
_dirtyRecordCount: 0,

Solution

  • The question in its full extend is a bit broad, so I am answering with only the basic facts. If you have a special question, amend your question and I will amend my answer.

    The dirty property is a change tracker on records and record fields, and subsequently used everywhere where records are referenced (grids, forms, form fields, models, stores...). E.g. if only certain parts of big records are dirty (e.g. a record containing an image and long text, and only the name changes), it may be better to e.g. just transmit the changed parts of the record to the server. Also, using the dirty state of the record, a store can determine which records (of possibly thousands) have to be submitted to the server because the server has to save changes on these records. Not submitting everything helps to reduce network load, database load and database log size.

    If didn't want the full overview, and just wanted to ask about the small red ear in the grid, you can get rid of it using

    viewConfig:{
        markDirty: false
    }