Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext Premium Member
    Join Date
    Sep 2010
    Posts
    16
    Vote Rating
    0
    alikic is on a distinguished road

      0  

    Default [FIXED-272] Ext.data.Reader.extractData() broken in sencha-touch-beta-0.94?

    [FIXED-272] Ext.data.Reader.extractData() broken in sencha-touch-beta-0.94?


    Sencha Touch version tested:
    • beta-0.94
    Platform tested against:
    • iOS 4.02
    Description:
    • I just tried to upgrade to beta-0.94. I have the following data model:
      Ext.regModel('MyModel', {
      fields: [ { name: 'name', convert: function (v, record) { return record.user.first + ' ' + record.user.last; } }
      ]
      });

      This used to work with beta-093. What I observe is that the conversion function is called twice, once with correct arguments via line 7289 (calling this.extractValues(node)), and then with incorrect arguments via line 7293 (calling new Model(values, id)). Obviously, the second call gives a javascript error.
    Test Case: The result that was expected:
    • No error
    The result that occurs instead:
    • Javascript error in the conversion function
    Screenshot or Video: Debugging already done: Possible fix:

  2. #2
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    18
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    Thank you for the report.

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

      0  

    Default


    I don't have enough information here to be able to construct a reliable test case and get you a fix. Could you provide a code sample demonstrating what the error is and how to reproduce it?
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,398
    Vote Rating
    128
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Bumping for some additional information.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Ext User
    Join Date
    Dec 2007
    Posts
    6
    Vote Rating
    0
    mark.postal is on a distinguished road

      0  

    Default


    I ran into this error as well in v0.95. On the first call rec is an Element and on the second call it is an Object.
    Here's my quick and dirty work around.


    Code:
    	Ext.regModel('StoredFilter', {
    	    fields: [
    			{name: 'id'},
    			{name: 'name'},
    			{name: 'delete', mapping: 'policy/delete'},
    			{name: 'edit', mapping: 'policy/edit'},
    			{name: 'edit_policy', mapping: 'policy/edit_policy'},
    	    	{name: 'filterXml', convert: function(v, rec){
    		    	var retval = v;
    		    	
    		    	// Workaround for bug in Sencha Touch 0.95
    		    	if (rec.ownerDocument) {
    					retval = Ext.DomQuery.selectNode('data', rec)
    		    	}
    		    	
    		    	return retval;
    		}}
    	    ]
    	});

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

      0  

    Default


    I'd love to be able to address this but I really don't have enough information to reproduce the problem. If you can provide a full test case that demonstrates the problem I'll happily work on a fix asap.

    This thread has a template bug report which contains all of the information we need to address bugs.
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  7. #7
    Ext User
    Join Date
    Jul 2010
    Location
    Kanagawa, Japan
    Posts
    12
    Vote Rating
    0
    taka_2 is on a distinguished road

      0  

    Default


    I reproduced the problem with below code using Sencha Touch 0.95.
    This code shows "convert/convert/Conan" in List.
    but It should be "convert/Conan"?

    Code:
    Ext.setup({
        onReady : function() {
            Ext.regModel('Person', {
                fields: [
                    {
                        name: 'name',
                        convert: function(v, rec) {
                            return "convert/" + v;
                        }
                    }
                ]
            });
    
            new Ext.List({
                fullscreen: true, 
                tpl: '<tpl for="."><div class="person">{name}</div></tpl>',
                itemSelector: 'div.person',
                singleSelect: true,
                store: new Ext.data.Store({
                    model: 'Person',
                    proxy: {
                        type: 'ajax',
                        url : '/OPEN-272/users.json',
                        reader: {
                            type: 'json',
                            root: 'rows'
                        }
                    },
                    autoLoad: true
                })
            });
        }
    });
    users.json contents:

    Code:
    {
        "rows": [
          {
            "name" : "Conan"
          }
        ]
    }

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

      0  

    Default


    Thanks for the test case, I have confirmed and fixed the bug (convert is called internally by Model now so the call from inside Reader was removed). This just made it in to the 0.96 release, which is just about to drop.
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

Similar Threads

  1. Replies: 10
    Last Post: 20 Jan 2012, 10:10 AM
  2. Ext JS and Sencha Touch!
    By mcamer in forum Sencha Touch 1.x: Discussion
    Replies: 8
    Last Post: 1 Dec 2010, 10:19 AM
  3. Combining Ext JS with Sencha Touch
    By PHANTOMIAS in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 14 Sep 2010, 7:22 AM
  4. Replies: 4
    Last Post: 9 Sep 2010, 5:20 AM

Thread Participants: 5

Tags for this Thread