View Full Version : Ext.ModelManager.create adds empty id field

13 Sep 2011, 9:56 AM
I'm trying to use Ext.data.Model + Rest proxy.
My code:

Ext.define('ExCategory', {
extend: 'Ext.data.Model',
idProperty: 'id',
fields: [
{ name: 'id', type: 'int'},
{ name: 'name', type: 'string' }
proxy: {

var ExCtg = Ext.ModelManager.getModel('ExerciseCategory');
var ctg12 = Ext.ModelManager.create({name: 'category12'}, 'ExCategory');

Manual says:

"Calling save (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.data.Model-method-save) on the new Model instance tells the configured RestProxy that we wish to persist this Model's data onto our server. RestProxy figures out that this Model hasn't been saved before because it doesn't have an id, and performs the appropriate action - in this case issuing a POST request to the url we configured (/users)."

but when I create new model instance, and call .save(), firebug shows me the empty id field in post data:

I suppose model instance must send everything execept non-initialized id field,
and retrive one from the server post reply

Did I miss somethong, or this is a bug ?