Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 205
oogles Avatar asked May 19 '11 02:05

oogles


1 Answers

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.

like image 80
machinery Avatar answered Nov 07 '22 17:11

machinery