1. #1
    Sencha User
    Join Date
    Apr 2010
    Posts
    8
    Vote Rating
    0
    skzr.org is on a distinguished road

      0  

    Exclamation Ext.data.ArrayReader.readRecords have a bug when mapping 'prop1.propNext'

    Ext.data.ArrayReader.readRecords have a bug when mapping 'prop1.propNext'


    • Ext 3.2.0
    Adapter used:
    • ext
    css used:
    • only default ext-all.css
    Browser versions tested against:
    • FF3 (firebug installed)
    Operating System:
    • ubuntu 9.10 64bit
    Description:
    • Ext.data.ArrayReader.readRecords have a bug when mapping 'prop1.propNext'
    Test Case:
    Code:
        var record = Ext.data.Record.create([
            {name: 'id', mapping: 'id'},
            {name: 'name', mapping: 'text'},
            {name: 'info', mapping: 'userData.info'},
            {name: 'order', mapping: 'userData.order'}
        ]);
        var store = new Ext.data.Store({sortInfo: {field: 'order'}, reader: new Ext.data.ArrayReader({id: 'id'}, record)})
        var win = new Ext.Window({
            closable: false,
            layout: 'fit',
            width: 700, height: 400,
            items: [{
                xtype: 'grid', title: ' ', iconCls: 'x-tree-node-icon-folder',
                tbar: ['-', {text: 'refresh'}, '-', '->'],
                columns: [
                    {header: 'ID', dataIndex: 'id', menuDisabled: true, hidden: true, width: 40, sortable: true, align: 'right'},
                    {header: 'name', dataIndex: 'name', hideable: false, width: 80, sortable: true},
                    {header: 'info', dataIndex: 'info', width: 100, sortable: true},
                    {header: 'order', dataIndex: 'order', width: 40, sortable: true, menuDisabled: true}
                ],
                store: store
            }]
        });
        win.show();
        var datas = [];
        for (var i = 0; i < 10; i++) {
            datas[i] = {id: i, text: 'text' + i, userData: {info: 'info' + i, order: i % 5}};
        }
        store.loadData(datas);
    var record = Ext.data.Record.create([
    {name: 'id', mapping: 'id'},
    {name: 'name', mapping: 'text'},
    {name: 'info', mapping: 'userData.info'},//not any effect
    {name: 'order', mapping: 'userData.order'}//not any effect too

    ]);

    My fix:
    the right code is:
    var records = this.extractData(this.getRoot(o), true);
    Code:
    if (Ext.version == '3.2.0') {
        Ext.apply(Ext.data.ArrayReader.prototype, {
            readRecords : function(o){
                this.arrayData = o;
                var s = this.meta, success = true, v;
    
                var records = this.extractData(this.getRoot(o), true);
                var totalRecords = records.length;
        
                if(s.totalProperty) {
                    v = parseInt(this.getTotal(o), 10);
                    if(!isNaN(v)) {
                        totalRecords = v;
                    }
                }
                if(s.successProperty){
                    v = this.getSuccess(o);
                    if(v === false || v === 'false'){
                        success = false;
                    }
                }
        
                return {
                    success : success,
                    records : records,
                    totalRecords : totalRecords
                };
            }
        });
    }

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,781
    Vote Rating
    599
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    What does your data look like? Shouldn't you be using a JsonReader?
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Posts
    8
    Vote Rating
    0
    skzr.org is on a distinguished road

      0  

    Default


    please see Test Case,then run the Test Case,you will see 'info' and 'order' columns is nothing each!

    Then add fix code,run Test Case again,you will see 'info' and 'order' columns is good!

    I load datas with treepanel! when select a treenode, show children list in the gridpanel! so i call store.loadData(treeNode.attributes.children)!
    my data like this:

    var datas = [];
    for (var i = 0; i < 10; i++) {
    datas[i] = {id: i, text: 'text' + i, userData: {info: 'info' + i, order: i % 5}};
    }

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,781
    Vote Rating
    599
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    You should be using a JsonReader, not an array reader. Moving to help.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha User
    Join Date
    Apr 2010
    Posts
    8
    Vote Rating
    0
    skzr.org is on a distinguished road

      0  

    Default


    Thanks!

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