ExtJS 4 instantiated model has id set to 0
问题 If I define an entity like this: Ext.define('MyApp.model.Entity', { extend : 'Ext.data.Model', fields : [ { name : 'id', type : 'int' } ] }); And then instantiate it and output its id with: var entity = Ext.create('MyApp.model.Entity'); console.log(entity.getId()); I'm getting 0 for the output. I would expect it to be undefined . Why is that? 回答1: There are two likely causes. First, because you're using the name id for a field. Ext.data.Model has the idProperty config which defaults to id ,