Created
February 28, 2011 09:23
-
-
Save tayfunoziserikan/847121 to your computer and use it in GitHub Desktop.
Store
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KebabOS.applications.producer.application.models.ProducersDataStore = Ext.extend(Ext.data.Store, { | |
// Owner Application | |
ownerApplication: null, | |
id: 'producer', | |
// RESTful enable | |
restful: true, | |
// Autoload enable | |
autoLoad: true, | |
// Remote sort enable | |
remoteSort: true, | |
// Autosave default disable | |
autoSave: false, | |
// Bathc editing default enable | |
batch: true, | |
// System REST API | |
restAPI: 'product/producer', | |
// Store Constructor | |
constructor : function() { | |
// HTTP Proxy | |
this.proxy = new Ext.data.HttpProxy({ | |
url : this.restAPI | |
}); | |
// JSON Reader | |
this.reader = new Ext.data.JsonReader({ | |
idProperty: 'id', | |
root: 'data', | |
totalProperty: 'total' | |
}, [ | |
{name: 'id'}, | |
{name: 'title', allowBlank: false}, | |
{name: 'description', allowBlank: false} | |
]); | |
// JSON Writer | |
this.writer = new Ext.data.JsonWriter({ | |
encode: true, | |
writeAllFields: false | |
}); | |
// Base Config | |
var config = { | |
proxy: this.proxy, | |
reader: this.reader, | |
writer: this.writer | |
} | |
// Merge initialConfig and base config | |
Ext.applyIf(this, config); | |
// Call Superclass initComponent() method | |
KebabOS.applications.producer.application.models.ProducersDataStore.superclass.constructor.apply(this, arguments); | |
}, | |
listeners : { | |
write : function(){ | |
new Kebab.OS.Notification().message('Üreticiler ve Markalar', 'Kayıt Başarılı') | |
}, | |
exception : function(){ | |
new Kebab.OS.Notification().message('Üreticiler ve Markalar', 'Kayıt Başarısız', true) | |
}, | |
scope:this | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment