I want to create my Model fields dynamically (in ExtJS 4). For instance, sometimes it is 0 to 3 and sometimes it is 0 to 7. This data comes from a JSON file (and store). This is my Model:
Ext.define('MyApp.model.User', {
extend: 'Ext.data.Model',
fields: ['0','1','2','3','4','5']
});
I tried many ways to get Model manually and create fields, but when it comes to a grid, I have empty rows of data without any errors. For example 8 empty rows in a grid.
Any help would be appreciated
Create a model with maximum number of fields (say from 0 to 15 if you know that 15 will be the max you will receive from the server).
ExtJs is very forgivable when model doesn’t match server response exactly. You should still got records created, just some fields will be
null.