You found a bug! We've classified it as EXTJS-9567 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    24
    Vote Rating
    3
    ElCondor1969 is on a distinguished road

      1  

    Default Conceptual bug in method "getRejectRecords" of a buffered store in ExtJS 4.2.0

    Conceptual bug in method "getRejectRecords" of a buffered store in ExtJS 4.2.0


    Hi to all.
    The current implementation of getRejectRecords in ExtJS 4.2.0 is:

    getRejectRecords: function() {
    // Return phantom records + updated records
    return Ext.Array.push(this.data.filterBy(this.filterNewOnly).items, this.getUpdatedRecords());

    If the store is buffered, this.data is a PageMap object and not a Mixed Collection object. While mixed collections have filterBy method, PageMap not. So, when you invoke the rejectChanges store method, who calls getRejectRecords method, if the store is buffered you get an exception, as I have experienced always in my proofs.
    I am at your disposal for any clarification.
    Bye!

    Sergio.

    *EDIT BY SLEMMON
    Tested in 4.2.0
    Tested in 4.2.1.762
    Code:
    Ext.define('ForumThread', {
        extend: 'Ext.data.Model',
        fields: [
            'title', 'forumtitle', 'forumid', 'username', {
                name: 'replycount',
                type: 'int'
            }, {
                name: 'lastpost',
                mapping: 'lastpost',
                type: 'date',
                dateFormat: 'timestamp'
            },
            'lastposter', 'excerpt', 'threadid'
        ],
        idProperty: 'threadid'
    });
    
    
    // create the Data Store
    var store = Ext.create('Ext.data.Store', {
        id: 'store',
        model: 'ForumThread',
        remoteGroup: true,
        // allow the grid to interact with the paging scroller by buffering
        buffered: true,
        leadingBufferZone: 300,
        pageSize: 100,
        proxy: {
            // load using script tags for cross domain, if the data in on the same domain as
            // this page, an Ajax proxy would be better
            type: 'jsonp',
            url: 'http://www.sencha.com/forum/remote_topics/index.php',
            reader: {
                root: 'topics',
                totalProperty: 'totalCount'
            },
            // sends single sort as multi parameter
            simpleSortMode: true,
            // sends single group as multi parameter
            simpleGroupMode: true,
    
    
            // This particular service cannot sort on more than one field, so grouping === sorting.
            groupParam: 'sort',
            groupDirectionParam: 'dir'
        },
        sorters: [{
            property: 'threadid',
            direction: 'ASC'
        }],
        autoLoad: true,
        listeners: {
    
    
            // This particular service cannot sort on more than one field, so if grouped, disable sorting
            groupchange: function(store, groupers) {
                var sortable = !store.isGrouped(),
                    headers = grid.headerCt.getVisibleGridColumns(),
                    i, len = headers.length;
                
                for (i = 0; i < len; i++) {
                    headers[i].sortable = (headers[i].sortable !== undefined) ? headers[i].sortable : sortable;
                }
            },
    
    
            // This particular service cannot sort on more than one field, so if grouped, disable sorting
            beforeprefetch: function(store, operation) {
                if (operation.groupers && operation.groupers.length) {
                    delete operation.sorters;
                }
            }
        }
    });
    
    
    function renderTopic(value, p, record) {
        return Ext.String.format(
            '<a href="http://sencha.com/forum/showthread.php?t={2}" target="_blank">{0}</a>',
            value,
            record.data.forumtitle,
            record.getId(),
            record.data.forumid
        );
    }
    
    
    var grid = Ext.create('Ext.grid.Panel', {
        width: 700,
        height: 500,
        collapsible: true,
        title: 'ExtJS.com - Browse Forums',
        store: store,
        loadMask: true,
        plugins: {
            ptype: 'cellediting'
        },
        tbar: [{
            text: 'Reject Changes'
            , handler: function () {
                grid.getStore().rejectChanges();
            }
        }],
        selModel: {
            pruneRemoved: false
        },
        multiSelect: true,
        viewConfig: {
            trackOver: false
        },
        features:[{
            ftype: 'grouping',
            hideGroupedHeader: false
        }],
        // grid columns
        columns:[{
            xtype: 'rownumberer',
            width: 50,
            sortable: false
        },{
            tdCls: 'x-grid-cell-topic',
            text: "Topic",
            dataIndex: 'title',
            flex: 1,
            renderer: renderTopic,
            sortable: true
        },{
            text: "Author",
            dataIndex: 'username',
            width: 100,
            hidden: true,
            sortable: true
        },{
            text: "Replies",
            dataIndex: 'replycount',
            align: 'center',
            width: 70,
            sortable: false,
            editor: {
                xtype: 'numberfield'
            }
        },{
            id: 'last',
            text: "Last Post",
            dataIndex: 'lastpost',
            width: 130,
            renderer: Ext.util.Format.dateRenderer('n/j/Y g:i A'),
            sortable: true,
            groupable: false
        }],
        renderTo: Ext.getBody()
    });
    Last edited by slemmon; 23 Apr 2013 at 9:07 AM. Reason: Added inline test case

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,895
    Vote Rating
    176
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Ext JS Premium Member
    Join Date
    May 2009
    Posts
    72
    Vote Rating
    1
    UGA_Zimma is on a distinguished road

      0  

    Default


    This seems to be a recurring theme. I get the same conflict when I call store.sync() on a buffered store.

    Is this a different bug or just another case of PageMap vs MixedCollection?

    Thanks,

    UGA_Zimma

  4. #4
    Ext JS Premium Member
    Join Date
    Aug 2011
    Posts
    2
    Vote Rating
    0
    chge is on a distinguished road

      0  

    Default Unfortunately, grouping seems to not work with buffered stores anymore.

    Unfortunately, grouping seems to not work with buffered stores anymore.


    There are some methods in Ext.data.Store (Ext JS 4.2.1) which reference "this.data.items" and trying to iterate over them.

    Grouping:
    Code:
    constructGroups
    getGroups
    getGroupData
    updateGroupsOnUpdate
    And some other:
    Code:
    each
    clearData
    sum
    min
    max
    average
    aggregate
    Ext.data.PageMap (this.data) doesn't have such property, but have some methods to iterate over records. It seems that implementation of Ext.data.Store should use them instead (when possible).

Thread Participants: 3

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