oogles
oogles

Reputation: 1232

ExtJS 4: Grids/Stores without Models

I have several grids that display data that doesn't really map to a Model, e.g. statistics, counts, etc. The values they display are dynamically generated by the server based on the currently-logged in user, and could be related to any number of server-side models.

It seems silly to set up an ExtJS Model for these situations. They might look something like:

Ext.define('???', {
    extend: 'Ext.data.Model',
    fields: ['name', 'count']
});

It doesn't make sense to me. I know the fields attribute of the store is still there, but the documentation states it is only really there for backwards compatibility and should be avoided. Plus, at least with the compatibility layer running, there's the console warning against using it.

So what is the "proper" approach for these situations?

Upvotes: 6

Views: 7623

Answers (1)

machinery
machinery

Reputation: 3945

Had a similar problem. Sencha claim that in such a case it's ok to use the 'fields' property. Check out this thread:

http://www.sencha.com/forum/showthread.php?136362-Extjs-4-Dynamic-Model/page2

on their forum.

Upvotes: 6

Related Questions