Threaded View

  1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    91
    Answers
    6
    Vote Rating
    0
    alex9311 is on a distinguished road

      0  

    Default Answered: generate random data for a store (MVC)

    Answered: generate random data for a store (MVC)


    Hey all,
    I'm trying to generate a random data set for a store but I'm having trouble. My generator function is undefined, I'm probably declaring it in the wrong place/way or calling it in the wrong way. Here is my code (for my store file).

    Code:
    Ext.define('TR.store.Trends', {
            extend: 'Ext.data.Store',
            model: 'TR.model.Trends',
            generateData : function(){
                    var data = [];
                    //logic to populate  data array missing, for now I am just
                    //pushing a single entry
                    data.push({
                            name: '2012-12-10',
                            number: 10,
                            percent: 8.7,
                    });
                    return data;
            },
            data:this.generateData(),
    });
    Any help on this is much appreciated

  2. At defining time of TR.store.Trends, 'this' is often window or some other object, not the store instance which will be existed only when you create an instance of the store. So this.generateData will often be undefined.
    Try to fix your code as below:
    Code:
    Ext.define('TR.store.Trends', {
        extend: 'Ext.data.Store',
        model: 'TR.model.Trends',
        generateData : function(){
            var data = [];
            //logic to populate  data array missing, for now I am just
            //pushing a single entry
            data.push({
                name: '2012-12-10',
                number: 10,
                percent: 8.7,
            });
            return data;
        },
        // data:this.generateData(),
        constructor: function(){
            this.data = this.generateData();
            this.callParent(arguments);
        }
    });

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