1. #1
    Sencha User
    Join Date
    Nov 2010
    Location
    Ukraine
    Posts
    11
    Vote Rating
    0
    NexusOne is on a distinguished road

      0  

    Default Buffered store.findExact() throw Object [object Object] has no method 'findIndexBy'

    Buffered store.findExact() throw Object [object Object] has no method 'findIndexBy'


    Hi again!
    I found that method store.findExact() call store.data.findIndexBy();
    For most stores store.data property is Ext.util.MixedCollection which has findIndexBy() method.
    But if store.buffered data property is PageMap (extend: 'Ext.util.LruCache', 'Ext.util.HashMap'). All this classes has no findIndexBy method =(

    Code:
           if (me.buffered) {
                me.data = new me.PageMap({
                    store: me,
                    pageSize: me.pageSize,
                    maxSize: me.purgePageCount,
                    listeners: {
                        // Whenever PageMap gets cleared, it means we re no longer interested in 
                        // any outstanding page prefetches, so cancel tham all
                        clear: me.onPageMapClear,
                        scope: me
                    }
                });
                me.pageRequests = {};
    
                me.sortOnLoad = false;
                me.filterOnLoad = false;
            } else {
        
                me.data = new Ext.util.MixedCollection(false, Ext.data.Store.recordIdFn);
                me.data.pageSize = me.pageSize;
            }

  2. #2
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,339
    Vote Rating
    132
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    How do you initiate this search? Since a buffered store is designed to be a partial view of the remote data, at best, only some records will be local and hence findable.

    I recall that we did merge a fix (it may be new to 4.2.0 beta 2 - http://www.sencha.com/forum/showthre...-Now-Available) that should allow you to find records that are "in view" under the assumption that this is often initiated by a row action or similar and the record is certain to be local.

    Beyond that special case, all other operations that would require complete knowledge will probably fail in this way as there is no point in implementing methods that cannot possibly work with partial data.
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  3. #3
    Ext JS Premium Member
    Join Date
    Oct 2007
    Posts
    81
    Vote Rating
    1
    miti is on a distinguished road

      0  

    Default


    This is not fixed in the 4.2.0 release. As long as store is buffered, both find and query fail.

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,502
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    We have a "fix" for this ready to go.

    But you do understand the limitation don't you?

    You will only get to search the few patches of the dataset that you have visited.

  5. #5
    Ext JS Premium Member
    Join Date
    Oct 2007
    Posts
    81
    Vote Rating
    1
    miti is on a distinguished road

      0  

    Default


    Thanks for the reply. Yes I do understand the limitation. In our app, we make sure the record we want find is fetched from the server side in a buffered store. So what is the fix? or when it will be available?

  6. #6
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,339
    Vote Rating
    132
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    If that is the case, why is the store buffered then? Just want to understand the use case here
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  7. #7
    Ext JS Premium Member
    Join Date
    Oct 2007
    Posts
    81
    Vote Rating
    1
    miti is on a distinguished road

      0  

    Default


    Quote Originally Posted by dongryphon View Post
    If that is the case, why is the store buffered then? Just want to understand the use case here
    Consider you want jump to a record in a grid. The grid has huge number of records but we know the id of the record you want jump to. So we can make sure to get the record from server when prefetch the records for the buffered store.

  8. #8
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,339
    Vote Rating
    132
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    Quote Originally Posted by miti View Post
    Consider you want jump to a record in a grid. The grid has huge number of records but we know the id of the record you want jump to. So we can make sure to get the record from server when prefetch the records for the buffered store.
    If the number of records is very large, then a buffered store is definitely the way to go - but in that case the store does not have the records so it cannot find them by id at least without your ensuring that the appropriate pages are fetched. Given an id though the store cannot know what pages that will be.

    Is there some why you solve that in your application?
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  9. #9
    Ext JS Premium Member
    Join Date
    Oct 2007
    Posts
    81
    Vote Rating
    1
    miti is on a distinguished road

      0  

    Default


    Quote Originally Posted by dongryphon View Post
    If the number of records is very large, then a buffered store is definitely the way to go - but in that case the store does not have the records so it cannot find them by id at least without your ensuring that the appropriate pages are fetched. Given an id though the store cannot know what pages that will be.

    Is there some why you solve that in your application?
    I pass the id back to the server to make sure that record is fetched.

    BTW, as you can see I have a premium member. we'd like to fix this issue asap. Can you point me to the direction how to fix this (I think i have access to your code base)?

  10. #10
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,502
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Try this override


    Code:
    Ext.override(Ext.data.Store.prototype.PageMap, {
    
            forEach: function(fn, scope) {
                var me = this,
                    pageNumbers = Ext.Object.getKeys(me.map),
                    pageCount = pageNumbers.length,
                    i, j,
                    pageNumber,
                    page,
                    pageSize;
    
                for (i = 0; i < pageCount; i++) {
                    pageNumbers[i] = Number(pageNumbers[i]);
                }
                Ext.Array.sort(pageNumbers);
                scope = scope || me;
                for (i = 0; i < pageCount; i++) {
                    pageNumber = pageNumbers[i];
                    page = me.getPage(pageNumber);
                    pageSize = page.length;
                    for (j = 0; j < pageSize; j++) {
                        if (fn.call(scope, page[j], (pageNumber - 1) * me.pageSize + j) === false) {
                            return;
                        }
                    }
                }
            },
    
           /**
            * Returns the first record in this page map which elicits a true return value from the
            * passed selection function.
            *
            * *IMPORTANT
            * This can ONLY find records which happen to be cached in the page cache. This will be parts of the dataset around the currently
            * visible zone, or recently visited zones if the pages have not yet been purged from the cache.
            * 
            * This CAN NOT find records which have not been loaded into the cache.*
            *
            * If full client side searching is required, do not use a buffered store, instead use a regular, fully loaded store and
            * use the {@link Ext.grid.plugin.BufferedRenderer BufferedRenderer} plugin to minimize DOM footprint.
            * @param {Function} fn The selection function to execute for each item.
            *  @param {Mixed} fn.rec The record.
            *  @param {Mixed} fn.index The index in the total dataset of the record.
            * @param {Object} [scope] The scope (`this` reference) in which the function is executed. Defaults to this PageMap.
            * @return {Object} The first record in this page map which returned true from the selection
            * function, or null if none was found.
            */
            findBy: function(fn, scope) {
                var me = this,
                    result = null;
    
                scope = scope || me;
                me.forEach(function(rec, index) {
                    if (fn.call(scope, rec, index)) {
                        result = rec;
                        return false;
                    }
                });
                return result;
            },
    
           /**
            * Returns the index *in the whole dataset* of the first record in this page map which elicits a true return value from the
            * passed selection function.
            *
            * *IMPORTANT
            * This can ONLY find records which happen to be cached in the page cache. This will be parts of the dataset around the currently
            * visible zone, or recently visited zones if the pages have not yet been purged from the cache.
            * 
            * This CAN NOT find records which have not been loaded into the cache.*
            *
            * If full client side searching is required, do not use a buffered store, instead use a regular, fully loaded store and
            * use the {@link Ext.grid.plugin.BufferedRenderer BufferedRenderer} plugin to minimize DOM footprint.
            * @param {Function} fn The selection function to execute for each item.
            *  @param {Mixed} fn.rec The record.
            *  @param {Mixed} fn.index The index in the total dataset of the record.
            * @param {Object} [scope] The scope (`this` reference) in which the function is executed. Defaults to this PageMap.
            * @return {Number} The index first record in this page map which returned true from the selection
            * function, or -1 if none was found.
            */
            findIndexBy: function(fn, scope) {
                var me = this,
                    result = -1;
    
                scope = scope || me;
                me.forEach(function(rec, index) {
                    if (fn.call(scope, rec)) {
                        result = index;
                        return false;
                    }
                });
                return result;
            }
    });

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