Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    64
    Vote Rating
    0
    jeroenvduffelen is on a distinguished road

      0  

    Exclamation [FIXED-114] Creating new instance of Model results in "dirty" object

    [FIXED-114] Creating new instance of Model results in "dirty" object


    I've got a simple model here:

    Code:
    Ext.regModel('book', {
    	idProperty: 'bookId',
    	fields: [
    		{name: 'bookId', type: 'string', defaultValue: 'grmbl..'},
    		{name: 'bookTitle', type: 'string'},
    	],
    });
    Code:
    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:

    clean.png

    Code:
    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:

    dirty.png

    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....

  2. #2
    Sencha User xantus's Avatar
    Join Date
    Aug 2007
    Location
    Seattle, WA
    Posts
    135
    Vote Rating
    0
    xantus is on a distinguished road

      0  

    Default


    Thanks. I created a ticket for this issue.
    Software Engineer
    http://xant.us/

  3. #3
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    7
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    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.
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  4. #4
    Sencha User
    Join Date
    Jun 2010
    Posts
    64
    Vote Rating
    0
    jeroenvduffelen is on a distinguished road

      0  

    Default


    Cool, posting another bug. Keeping you guys busy ;-)

  5. #5
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    7
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    Quote Originally Posted by jeroenvduffelen View Post
    Cool, posting another bug. Keeping you guys busy ;-)
    Thanks, we appreciate it
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  6. #6
    Sencha User
    Join Date
    Jun 2010
    Posts
    64
    Vote Rating
    0
    jeroenvduffelen is on a distinguished road

      0  

    Default


    Using this code I still get dirty objects with Sencha Touch version 0.91

    Code:
    		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',
    		});

  7. #7
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    7
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    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.
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  8. #8
    Sencha User
    Join Date
    Jun 2010
    Posts
    64
    Vote Rating
    0
    jeroenvduffelen is on a distinguished road

      0  

    Default


    Cool! Keeping you sharp

  9. #9
    Sencha User gcallaghan's Avatar
    Join Date
    Apr 2010
    Location
    Cupertino, Ca
    Posts
    247
    Vote Rating
    1
    gcallaghan is on a distinguished road

      0  

    Default


    Is this fixed?
    I am getting models marked as dirty when I load a store with a localstorage proxy.

Similar Threads

  1. Manually set Model as edited (dirty)
    By micgala in forum Ext GWT: Discussion
    Replies: 3
    Last Post: 19 Jan 2010, 8:52 AM
  2. Transfer widget values to model instance - conceptual question
    By TheBerliner in forum Ext 3.x: Help & Discussion
    Replies: 15
    Last Post: 21 Nov 2009, 10:51 PM
  3. Object reference not set to an instance of an object
    By johnjalani in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 28 Jan 2009, 8:33 AM
  4. Replies: 9
    Last Post: 18 Apr 2008, 3:27 PM

Thread Participants: 3

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar