Results 1 to 9 of 9

Thread: BufferedStore autoLoads even if autoLoad is set to false

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1

    Default BufferedStore autoLoads even if autoLoad is set to false

    Ext version tested:
    • ExtJS

    • 6.0.1.250
    Browser versions tested against:
    • GoogleChrome 46.0.2490.71
    Description:
    • Buffered store autoLoads even if autoLoad is set to false.
    Steps to reproduce the problem:
    • create a BufferedStore with autoLoad: false
    The result that was expected:
    • store doesn't load
    The result that occurs instead:
    • store automatically loads

    Fiddle: https://fiddle.sencha.com/#fiddle/108o

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Can you outline the use case? The store loads because the grid asks it to for the records to fill the view. If you're intending to start the load yourself, how are you planning on calculating the correct items to load?
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3

    Default

    If I explicitly set autoLoad to false, then I expect it not to load.

    My use case is a bit more complex. I have a stateful remote sort BufferedStore with autoLoad set to false, yet it still loads.

    If I set autoLoad to true, it tries to load twice. What happens is, that it calls the server side 6 times, and 1 request gets canceled from the fronted. How many times it calls the server side of course depends on the leading and trailing buffer zone.

    Chrome Network Tab:

    network.png

    Canceled request query string parameters

    canceledRequestQueryStringParameters.png

    First successful xhr query string parameters:

    firstSuccess.png

    At first I thought that, my problem has something to do with applyState but was unable to reproduce it in the fiddle, then I saw the strange autoLoad behaviour.

    But now, while I was getting more and more frustrated, I noticed the same behaviour in the fiddle. Even though the request does not get canceled, you can see that the first page gets requested, then loading.gif, then the first page again and second and third, ..

    fiddle.jpg

    Fiddle: https://fiddle.sencha.com/#fiddle/1091
    (you need to run the fiddle, sort a column and then run it again to see this behaviour)

  4. #4
    Sencha Premium Member
    Join Date
    Apr 2008
    Posts
    369

    Default

    A common use case is that you need to configure some extraParams on the proxy dynamically before the store is loaded for the first time. The initial configuration of the store's proxy might not be valid and may result in an error, so it is important to be able to manually trigger the first load. I believe this worked in ExtJS 5, you just call .load() after you're done configuring the proxy and the buffered store starts doing its paging thing.

    For example, if the buffered store is being used to load search results, I might not want any loads to happen until after the user inputs a query and hits enter. After calling load the behavior should be the same as if the store was preconfigured with the extraParams -- paging is handled automatically.
    Chief Architect @ Jarv.us Innovations
    Co-captain @ Code for Philly

    Jarvus builds and optimizes top-quality Sencha Touch and ExtJS apps for open-source projects and clients of all sizes.

    Don't waste time with bugs that have already been found and fixed by the community, compile our tried and tested hotfixes packages into all your projects: https://github.com/JarvusInnovations/sencha-hotfixes

  5. #5

    Default

    Anything from anyone @Sencha?

  6. #6
    Sencha User
    Join Date
    Apr 2016
    Location
    Noida, India
    Posts
    4

    Default

    Is this bug still open? I'm still facing this issue with extjs 6.

    Any workarounds that work with extjs 6 will be much appreciated.

  7. #7
    Sencha User
    Join Date
    Apr 2016
    Location
    Noida, India
    Posts
    4

    Default

    In my case saving the grid sorters state was not critical so I could override the applyState to disable autoLoad.

    Code:
    applyState: function(state) {
    var me = this,
                stateSorters = state.sorters,
                stateFilters = state.filters,
                stateGrouper = state.grouper;
            if (stateSorters) {
                // don't apply the sorters state to prevent the auto load of this buffered store
                // me.getSorters().replaceAll(stateSorters); <-- this is the only changed line, just commented it
            }
            if (stateFilters) {
                // We found persisted filters so let's save stateful filters from this point forward.
                me.saveStatefulFilters = true;
                me.getFilters().replaceAll(stateFilters);
            }
            if (stateGrouper) {
                me.setGrouper(stateGrouper);
            }
    }

  8. #8

    Default

    I'm also struggling with this. I tried to override data.BufferedStore but the above code supplied by rattanc didn't kick in for me, which is OK since sorting state is something I need.

    As far as use case scenarios go Evant, I have a form loading several associated grids. The buffered store has remoteSort & remoteFilter set to true. After the form loads I need to apply a filter to the grids only if the form has certain values. What's occurring is the OnLoad event triggers immediately after autoLoad and then throws an error because the filter hasn't been applied yet (since the form has that value). Ideally I don't want to load the first page of data until I know if a filter or other parameters need to be set.

    Any more recent thoughts from someone?

    Thanks

  9. #9
    Sencha Premium User
    Join Date
    Dec 2010
    Posts
    288

    Default

    Over two years and no fix yet??

Similar Threads

  1. Replies: 6
    Last Post: 23 Nov 2015, 3:09 AM
  2. [CLOSED] TreeStore ignores autoLoad: false
    By eja40 in forum Ext:Bugs
    Replies: 17
    Last Post: 16 Sep 2014, 10:54 AM
  3. My Store 'AutoLoad = False' Not Working
    By OrinduA in forum Sencha Touch 2.x: Q&A
    Replies: 5
    Last Post: 8 Aug 2014, 4:38 AM
  4. Tree Store with autoLoad 'false' = bug?
    By amsoft in forum Ext 5: Q&A
    Replies: 2
    Last Post: 7 Aug 2014, 4:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •