Threaded View

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    56
    Vote Rating
    2
    geniodella is on a distinguished road

      1  

    Default nested data into xtemplate dataview example using extjs 4.0.7 with MVC

    nested data into xtemplate dataview example using extjs 4.0.7 with MVC


    Hi Guys,
    i was finally able to use nested data in xtemplate dataview overriding three functions
    of the abstractview in the version 4.0.7 of extjs taking the implementation
    from the release candidate 4.1 and the implementation of the update indexes
    from a forum in internet because the one on the RC is not perfect.



    Code:
    Ext.Loader.setConfig({enabled: true});
    
    
    Ext.override(Ext.view.AbstractView, {
        prepareData: function(data, index, record) {
           var associatedData, attr;
            if (record) {
                associatedData = record.getAssociatedData();
                for (attr in associatedData) {
                    if (associatedData.hasOwnProperty(attr)) {
                        data[attr] = associatedData[attr];
                    }
                }
            }
            return data;
        }
    });
    
    
    Ext.override(Ext.view.AbstractView, {
        collectData : function(records, startIndex){
            var data = [],
                i = 0,
                len = records.length,
                record;
    
            for (; i < len; i++) {
                record = records[i];
                data[i] = this.prepareData(record.data, startIndex + i, record);
            }
            return data;
        },
    
        // private
        bufferRender : function(records, index){
            var me = this,
                div = me.renderBuffer || (me.renderBuffer = document.createElement('div'));
    
            me.tpl.overwrite(div, me.collectData(records, index));
            
            return Ext.query(me.getItemSelector(), div);
        }
    });
    
    
    Ext.override(Ext.view.AbstractView, {
       // private
         updateIndexes : function(startIndex, endIndex) {
            var ns = this.all.elements,
                records = this.store.getRange();
            startIndex = startIndex || 0;
            endIndex = endIndex || ((endIndex === 0) ? 0 : (ns.length - 1));
            for(var i = startIndex; i <= endIndex; i++){
                ns[i].viewIndex = i;
                ns[i].viewRecordId = ((records.length > i) && records[i]) ? records[i].internalId : undefined;
                if (!ns[i].boundView) {
                    ns[i].boundView = this.id;
                }
            }
        }
    });
    Last edited by mitchellsimoens; 21 Mar 2012 at 6:41 AM. Reason: added [CODE] tags

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