1. #1
    Sencha User JamieMason's Avatar
    Join Date
    Apr 2010
    Location
    Leeds, UK
    Posts
    42
    Vote Rating
    0
    JamieMason is on a distinguished road

      0  

    Default Answered: Equivalent of Ext.data.reader.Reader.readRecords when creating Model directly?

    Answered: Equivalent of Ext.data.reader.Reader.readRecords when creating Model directly?


    I'm in a sorry position where I have to transform the data I'm getting so it's workable, I've overridden Ext.data.reader.Reader.readRecords to do this when the data comes in from the Server.

    I'm writing unit tests for this code at the moment and in those I'm using Ext.create to instantiate my test stubs. When calling Ext.create though, the Ext.data.reader.* isn't involved.

    Is there an equivalent method which transforms the data passed to Ext.create?

    Code:
    Ext.define('SomeModel', {    extend: 'Ext.data.Model'
        , proxy: {
            type: 'ajax'
            , url: 'http://etc'
            , reader: {
                type: 'json'
                , readRecords: function (suckyJson)
                {
                    var somethingICanUse = [];
                    
                    // Herd cats
                    
                    return new Ext.data.ResultSet({
                        records: somethingICanUse
                        , success: true
                        , total: somethingICanUse.length
                        , count: somethingICanUse.length
                    });
                }
            }
        }
        , fields: [
            // my fields
        ]
    });
    Thanks.

  2. This thread is vaguely related:

    http://www.sencha.com/forum/showthread.php?144756

    Thought occurs that for testing the reader you could try using a memory proxy:

    http://docs.sencha.com/ext-js/4-0/#!...a.proxy.Memory

    That said, I don't really understand why you'd need to use the real reader and fake models in the same unit test. Seems a bit odd to me.

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,581
    Answers
    540
    Vote Rating
    318
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    This thread is vaguely related:

    http://www.sencha.com/forum/showthread.php?144756

    Thought occurs that for testing the reader you could try using a memory proxy:

    http://docs.sencha.com/ext-js/4-0/#!...a.proxy.Memory

    That said, I don't really understand why you'd need to use the real reader and fake models in the same unit test. Seems a bit odd to me.

  4. #3
    Sencha User JamieMason's Avatar
    Join Date
    Apr 2010
    Location
    Leeds, UK
    Posts
    42
    Vote Rating
    0
    JamieMason is on a distinguished road

      0  

    Default


    Thanks again Skirtle

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi