View Full Version : [FIXED-114] Creating new instance of Model results in "dirty" object

28 Jun 2010, 2:24 AM
I've got a simple model here:

Ext.regModel('book', {
idProperty: 'bookId',
fields: [
{name: 'bookId', type: 'string', defaultValue: 'grmbl..'},
{name: 'bookTitle', type: 'string'},

var objBook = Ext.ModelMgr.create({}, 'book');

When create a new instance of this model without any values i get a clean new object as a result:


var objBook = Ext.ModelMgr.create({
bookId: 'testId',
bookTitle: 'testTitle',
}, 'book');

But when I create a new instance of this model with values i get a dirty object like this:


So it doesn't only add the field values to the data object inside the model but it adds the values to the object itself as well....

29 Jun 2010, 11:13 AM
Thanks. I created a ticket for this issue.

29 Jun 2010, 11:49 AM
Finally tracked this down, it's because Model now inherits from Observable. Fixed the problem in source control so it will make the next release.

29 Jun 2010, 12:42 PM
Cool, posting another bug. Keeping you guys busy ;-)

29 Jun 2010, 12:43 PM
Cool, posting another bug. Keeping you guys busy ;-)

Thanks, we appreciate it :)

30 Jun 2010, 4:14 PM
Using this code I still get dirty objects with Sencha Touch version 0.91

var store = new Ext.data.JsonStore({
autoLoad: true,
model: 'book',
proxy: {
url: '/books.json',
type: 'ajax',
reader: {
root: 'books',
type: 'json',
writer: {
type: 'json',
storeId: 'books',

30 Jun 2010, 4:25 PM
Yeah we fixed it but another piece of the code was relying on the bug. I deliberately restored the incorrect behavior you mention until we update the other code to honor the data property correctly.

30 Jun 2010, 4:26 PM
Cool! Keeping you sharp ;)

23 Feb 2011, 6:05 PM
Is this fixed?
I am getting models marked as dirty when I load a store with a localstorage proxy.