3

I have plenty of fields that I want to add to my model. I fount this thread Dynamic Model with ExtJS 4 but in 5th version there is no method setFields for the model.

Community
  • 1
  • 1
antosiy
  • 131
  • 1
  • 11

3 Answers3

4

Thanks for everybody, I used method addFields() and made it in this way:

var model = Ext.ClassManager.get('app.model.GridModel');
var fields = [];
fields.push({ name: 'param', type: 'string' });
for (var i=1; i<20; i++){
   fields.push({ name: 'name', type: 'string'});
}
model.addFields(fields);
antosiy
  • 131
  • 1
  • 11
0

Use Ext.data.Model.setConfig() method.

Sergey Novikov
  • 4,096
  • 7
  • 33
  • 59
0

There is a replaceFields method, though.

Note that this won't magically create the field data any existing models, though.

Robert Watkins
  • 2,196
  • 15
  • 17