Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-6194 in a recent build.
  1. #1
    Ext JS Premium Member
    Join Date
    Mar 2009
    Posts
    198
    Vote Rating
    1
    rspaeth is on a distinguished road

      0  

    Default removeAll on buffered grid causes error in cancelAllPrefetches

    removeAll on buffered grid causes error in cancelAllPrefetches


    REQUIRED INFORMATION
    Ext version tested:
    • Ext 4.1 release
    Browser versions tested against:
    • FF
    Description:
    • Remove all is not possible in a buffered grid. Errors occur in cancelAllPrefetches
    Steps to reproduce the problem:
    • use the buffered grid example
    • add a store.removeAll to the end of the script
    • run the script
    The result that was expected:
    • the items to be removed from the grid
    The result that occurs instead:
    • an error ( can't convert undefined to object ) occurs in cancelAllPrefetches
    • req is undefined, so deleting it while referencing .callback throws an error
    Test Case:
    this is the buffered grid example with a remove all at the end
    Code:
    Ext.define('Employee', {
        extend: 'Ext.data.Model',
        fields: [
           {name: 'rating', type: 'int'},
           {name: 'salary', type: 'float'},
           {name: 'name'},
           {name: 'percent'}
        ]
    });
    
    
    Ext.onReady(function(){
        /**
         * Returns an array of fake data
         * @param {Number} count The number of fake rows to create data for
         * @return {Array} The fake record data, suitable for usage with an ArrayReader
         */
        function createFakeData(count) {
            var firstNames   = ['Ed', 'Tommy', 'Aaron', 'Abe', 'Jamie', 'Adam', 'Dave', 'David', 'Jay', 'Nicolas', 'Nige'],
                lastNames    = ['Spencer', 'Maintz', 'Conran', 'Elias', 'Avins', 'Mishcon', 'Kaneda', 'Davis', 'Robinson', 'Ferrero', 'White'],
                ratings      = [1, 2, 3, 4, 5],
                salaries     = [100, 400, 900, 1500, 1000000];
    
    
            var data = [];
            for (var i = 0; i < (count || 25); i++) {
                var ratingId    = Math.floor(Math.random() * ratings.length),
                    salaryId    = Math.floor(Math.random() * salaries.length),
                    firstNameId = Math.floor(Math.random() * firstNames.length),
                    lastNameId  = Math.floor(Math.random() * lastNames.length),
    
    
                    rating      = ratings[ratingId],
                    salary      = salaries[salaryId],
                    name        = Ext.String.format("{0} {1}", firstNames[firstNameId], lastNames[lastNameId]);
    
    
                data.push({
                    rating: rating,
                    salary: salary,
                    name: name
                });
            }
            return data;
        }
    
    
        // Create the Data Store.
        // Because it is buffered, the automatic load will be directed
        // through the prefetch mechanism, and be read through the page cache
        var store = Ext.create('Ext.data.Store', {
            id: 'store',
            // allow the grid to interact with the paging scroller by buffering
            buffered: true,
            // Configure the store with a single page of records which will be cached
            pageSize: 5000,
            data: createFakeData(5000),
            model: 'Employee',
            proxy: {
                type: 'memory'
            }
        });
    
    
        var grid = Ext.create('Ext.grid.Panel', {
            width: 700,
            height: 500,
            title: 'Bufffered Grid of 5,000 random records',
            store: store,
            loadMask: true,
            disableSelection: true,
            viewConfig: {
                trackOver: false
            },
            // grid columns
            columns:[{
                xtype: 'rownumberer',
                width: 40,
                sortable: false
            },{
                text: 'Name',
                flex:1 ,
                sortable: true,
                dataIndex: 'name'
            },{
                text: 'Rating',
                width: 125,
                sortable: true,
                dataIndex: 'rating'
            },{
                text: 'Salary',
                width: 125,
                sortable: true,
                dataIndex: 'salary',
                align: 'right',
                renderer: Ext.util.Format.usMoney
            }],
            renderTo: Ext.getBody()
        });
        
        store.removeAll();
    });

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,617
    Vote Rating
    396
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Thank you for the report.

    Scott.

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    16
    Vote Rating
    0
    catalinux1907 is on a distinguished road

      0  

    Default


    This problem was not fixes entirely. The problem is related to other "problem". I try to explain it.

    Let's say I have a buffered grid with 1000 result and 200rows per page. When I filter remote I will have only 82 result. Somehow the server gets two calls (for page 1 and 2) . First page get rows from 1 to 82. the seconds gets 0 .

    Because of that when I try a removeAll after these event it will try to delete an undfiened page.

    It worked if I do the following overide. Probably I should override pre prefetch method where some line puts an "undedined" value for a page


    Code:
    Ext.override(Ext.data.Store, {
        cancelAllPrefetches: function() {
            var me = this,
                reqs = me.pageRequests,
                req,
                page;
    
    
    
            if (me.pageMap.events.pageadded) {
                me.pageMap.events.pageadded.clearListeners();
            }
    
    
    
            for (page in reqs) {
                if (reqs.hasOwnProperty(page)) {
                    req = reqs[page];
                    delete reqs[page];
                    if(typeof req !== "undefined")                {
                        delete req.callback;
                    }
                }
            }
        }
    });
    I'm using ext-4.1.1a
    Last edited by catalinux1907; 22 Nov 2012 at 6:33 AM. Reason: I missed saying which version I used

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar