Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BufferedStoreStrictId patch to 4.2.2, 4.2.3, and 5.0.* branches #1

Open
themightychris opened this issue Jun 9, 2015 · 0 comments

Comments

@themightychris
Copy link
Member

Fiddle that demonstrates the problem in 4.2.2 and 4.2.3: https://fiddle.sencha.com/#fiddle/oap
Fiddle that demonstrates it in 5.0.x: https://fiddle.sencha.com/#fiddle/oau

This patch is tested in 4.2.x but not 5.0.x

/**
 * Fixes issue where grouped+buffered stores fail to find correct record on hover/click due to string===int comparison
 * 
 * See http://www.sencha.com/forum/showthread.php?273049
 */
Ext.define('Jarvus.ext.patch.data.BufferedStoreStrictId', {
    override: 'Ext.data.Store',

    getByInternalId: function(internalId) {
        var result;

        if (this.buffered) {
            result = (this.snapshot || this.data).findBy(function(record) {
                return record.internalId == internalId; // changed from === to ==
            });
            //<debug>
            if (!result) {
                Ext.Error.raise('getByInternalId called for internalId that is not present in local cache');
            }
            //</debug>
        } else {
            result = this.data.get(internalId);
        }
        return result;
    }

}, function() {
    //<debug>
    if (!Ext.getVersion().match('4.2.2.1144')) {
        console.warn('This patch has not been tested with this version of ExtJS');
    }
    //</debug>
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant