Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default Buffered Ext.data.Store issues

    Buffered Ext.data.Store issues


    1) If I use guaranteeRange(0, myPageSize-1) on a Store (Ajax proxy), and the server returns no rows, I don't consider this to be an error. The framework begs to differ (start > end error). Your examples use this to load stores that are buffered, so I expect that this is how I'm supposed to do it. Is this correct, or is no rows returned from a query really a case that requires a hard exception? Sometimes a lookup returns nothing, and that's OK. Perhaps "tryGuaranteeRange()" is more appropriate for real world use?

    2) Try using the Buffered Grid example on the sencha site in IE9 (not infinite scrolling example). Click in the paging space of the scroller. Scroll thumb doesn't move, rows don't update. DRAG the thumb, and it scrolls. This doesn't happen in the infinite scroll example, for reasons I can't determine.

    3) I'd love to know what "Record was not found and store said it was guaranteed" means? I got that running the infinite scrolling example in IE9 on the sencha site this morning.

    stevil

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,400
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    1) Agreed... just because its requested a specific range to guarantee doesnt mean the server-side actually had that range. We'll revisit this.

    2) We're aware of this problem and actively tracking it. Basically the scroller is as wide as the div that contains it. IE says oh there is no visible space and won't allow you to scroll it.

    3) Somehow the record has been purged out of the prefetched data before it should have been. If you can help us pinpoint how to reproduce this it would help us track it down.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Ext GWT Premium Member
    Join Date
    Apr 2011
    Posts
    63
    Vote Rating
    0
    gctram is on a distinguished road

      0  

    Default


    I have been facing the same issue. Just couldn't avoid the error "Record was not found and store said it was guaranteed" . Attaching the sample code.

    Code:
    Ext.Loader.setConfig({enabled: true});
    
    Ext.Loader.setPath('Ext.ux', '../ux/');
    Ext.require([
        'Ext.grid.*',
        'Ext.data.*',
        'Ext.data.BufferStore',
        'Ext.util.*',
        'Ext.grid.PagingScroller'
    ]);
    
    Ext.onReady(function(){
       Ext.define("thm", {extend: "Ext.data.Model", fields: [{name:'pgNo',type:'string'}]});
    
            var storeConfig = new Ext.data.BufferStore({            
                model: 'thm',
                pageSize: 20,  			
    	    buffered: true,
                proxy: {
                    type:"thm_proxy",
                    url: "ivf/dummyurl",
    		extraParams: {
                    total: 1000
                },				
                    reader: {                    
                        root: 'pages',
                        totalProperty: 'totalCount'
                    }
                }
            });		
    		
        var grid = new Ext.grid.GridPanel(
    	{
    			width: 150,
    			height: 300,			
    			store: storeConfig,
    			verticalScrollerType: 'paginggridscroller',
    			loadMask: true,			
    			invalidateScrollerOnRefresh: false,
    			viewConfig: {			
                                  //trackOver: false
    			},               
    			renderTo: Ext.getBody(),
    				
                columns: [{
                    dataIndex: 'pgNo',
    				align: 'center',
    				flex:1
                }]
    
            }        
        );
        
        // trigger the data store load
        storeConfig.guaranteeRange(0, 19);
    });
    
    Custom proxy which gives me back a json of the records containing row numbers 
    
    Ext.namespace("xcp.ivf");
    
    (function() {
    
    Ext.define("xcp.ivf.ThmProxy", {
        extend: "Ext.data.ServerProxy",
        alias: 'proxy.thm_proxy',
        constructor : function(config) {       
            xcp.ivf.ThmProxy.superclass.constructor.call(this, config);
        },
        doRequest: function(operation, loadCallback, scope) {
    
            var me = this,
                    writer = me.getWriter(),
                    request = me.buildRequest(operation, loadCallback, scope),
                    args = [],
                    params = request.params,
                    reader = me.getReader();
            var i = 1;
            var j = operation.start;
            var jsonObj = {
                "totalCount": 1000,
                "pages":[{pgNo:(++j).toString()}]
            };
    
            for (; i < operation.limit; i++)
            {
                jsonObj.pages[i] = {pgNo:(++j).toString()};
            }
    
            var readData = reader.read(jsonObj);
            console.log("start,limit :" + operation.start + "," + operation.limit);
            var records = readData.records ? readData.records : [];
    		
            var operationCfg = {
                action: "read",
                success:true,
                complete:true			
            };
    	Ext.apply(operation,operationCfg);
            operation.resultSet = Ext.create('Ext.data.ResultSet', {
                records: records
                ,total  : 1000           
            });		
    		
    		operation.setStarted(true);		
            loadCallback.call(scope, operation, args, true);
        }
    });
    })();

  4. #4
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    Quote Originally Posted by aconran View Post
    1) Agreed... just because its requested a specific range to guarantee doesnt mean the server-side actually had that range. We'll revisit this.
    Great news, thanks for that update! BTW, I'm having a running (friendly) debate with Jackie over this, but 1) it's DEBUG code that generates this (and the error listed in #3). It's not stripped out of ext-all-debug OR ext-all. I think we need a non-minified "all" version without this debug code.

    Quote Originally Posted by aconran View Post
    2) We're aware of this problem and actively tracking it. Basically the scroller is as wide as the div that contains it. IE says oh there is no visible space and won't allow you to scroll it.
    That's a nasty one, to be sure, I wish I had more help for you there.

    Quote Originally Posted by aconran View Post
    3) Somehow the record has been purged out of the prefetched data before it should have been. If you can help us pinpoint how to reproduce this it would help us track it down.
    I was able to do this consistently in IE9, with the sencha site's Buffered Grid (not infinite scroll example). It's a touch contrived, because it's tripping over a quirky IE9 behavior, but:

    1) Load the buffer-grid example.
    2) Immediately, click the source code link over the grid.
    3) IE9 will put a warning up about the file not being safe. Wait 30 seconds, and answer.
    4) At some point in time, you'll then see that message.

    It's weird, true, but it happens to me all the time. Now, is it a "real world" use case? I doubt it. I wouldn't ding you for getting hit by a browser interfering with you, which it seems this is. That said, it might help to flush out the behavior.

    If I can come up with more information, I'll relay it to you here!

    stevil

  5. #5
    Ext GWT Premium Member
    Join Date
    Apr 2011
    Posts
    63
    Vote Rating
    0
    gctram is on a distinguished road

      0  

    Default


    It occurs to me very frequently. What is the significance of guaranteeRange() call. Should'nt it be fine if the store gets the guaranteed no of records from the proxy ?

  6. #6
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    Quote Originally Posted by gctram View Post
    It occurs to me very frequently. What is the significance of guaranteeRange() call. Should'nt it be fine if the store gets the guaranteed no of records from the proxy ?
    Aaron's first point in his response indicates that it is fine, and they will revisit it.

    stevil

  7. #7
    Ext GWT Premium Member
    Join Date
    Apr 2011
    Posts
    63
    Vote Rating
    0
    gctram is on a distinguished road

      0  

    Default


    What is the right proxy to use if am simulating data generation at the client side. I have a custom server proxy which gives back data without server fetch. But the error we discussed keeps occurring. I do not want to load all the data in a single shot at the client side. It should be loaded as I scroll. Can a MemoryProxy fit this scenario ?

  8. #8
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,400
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    This ticket is being tracked under EXTJSIV-1897.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  9. #9
    Sencha User
    Join Date
    May 2011
    Location
    Toronto, Canada
    Posts
    5
    Vote Rating
    0
    GregXII is on a distinguished road

      0  

    Default


    Quote Originally Posted by gctram View Post
    It occurs to me very frequently. What is the significance of guaranteeRange() call. Should'nt it be fine if the store gets the guaranteed no of records from the proxy ?
    It configured properly, it should not generate an error, even if the range is not fulfilled. Just make the initial call something like "store.guaranteeRange(0, store.pageSize - 1)", The scroller should take care of subsequent loads by checking your store's pageSize.

    This snippet is from the onGuaranteedRange function of Ext.data.Store:

    Code:
    end = ((totalCount - 1) < me.requestEnd) ? totalCount - 1 : me.requestEnd)
    ...
    me.guaranteedEnd = end;
    so you see, if a smaller set of data is found, the store adapts accordingly. Just make sure that even if there are no records, you at least return an empty data set, e.g. "data: []"

  10. #10
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    Happens to me even with an empty data set in the JSON.

Similar Threads

  1. Replies: 9
    Last Post: 28 Nov 2012, 3:00 AM
  2. [FIXED] Buffered Store with infinite grid - scrolling issues
    By gctram in forum Ext:Bugs
    Replies: 14
    Last Post: 8 May 2012, 6:32 AM
  3. [OPEN-EXTJSIV-207] Mixins issues
    By LesJ in forum Ext:Bugs
    Replies: 3
    Last Post: 21 Mar 2011, 12:58 PM
  4. [OPEN-EXTJSIV-205] Numeric axis issues
    By vdan in forum Ext:Bugs
    Replies: 1
    Last Post: 20 Mar 2011, 11:21 PM
  5. Replies: 1
    Last Post: 20 Aug 2010, 10:34 PM

Thread Participants: 9