开发者

Extjs 4.0 store - how to find fields in the store (or model)

In Ext 3.x I could get an array of field names with this:

mystore.fields.keys

How can I do this in 4.0? I can't even see how I can get the model that the store is using (no 'getModel' method). Do I need to find a record and get the fields that way? I define the store with :

Ext.define('AM.store.Equipments', {
    extend: 'Ext.data.Store',
    model: 'AM.model.Equipment',

    mycustFunc: function 开发者_开发知识库() {
            var myfields = this.fields.keys  (fails!)

EDIT: Thanks... looking in firebug more it seems like this gets what I want:

this.model.prototype.fields.keys


While there isn't a getModel() method for the Store itself, the Proxy holds the Model, so you can simply use store.getProxy().getModel() to fetch the Model, and thereby the Model's fields. For replicating a Store, just use model: originalStore.getProxy().getModel().modelName.


i change the fields from my store,
just like that:

myStore.model.setFields(fields);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜