[FIXED] [#853] [3.2.1] Store's AutoLoad="false" is ignored if RemoteFilter="true"

  1. #1

    [FIXED] [#853] [3.2.1] Store's AutoLoad="false" is ignored if RemoteFilter="true"

    NOTE: the thread appeared after moving posts about an individual issue from this thread:
    http://forums.ext.net/showthread.php?59826

    ----
    Hi,

    yes, we understand what is the problem and try AutoLoad(false), but it's not work, in our case, we use combobox + store + windows with grid (shared store putted on paner with Bin(store) method), and store for combobox and store for grid in window, we set through StoreID property of components, for store we set AutoLoad(false). But store start load before click on combobox trigger or before we call window.show() and store.load(), how can we resolve that problem?
    Last edited by Daniil; Aug 11, 2015 at 2:52 PM. Reason: [FIXED] [#853] [3.2.1]
  2. #2
    So, what I understand is that the Store loads automatically regardless .AutoLoad(false), right? Could you, please, provide a full test case to reproduce it?
  3. #3

    Example

    Hi,

    we understand where promblem is, when we set RemoterFilter(true), AutoLoad not occur, but when we set for grid column Filter(Html.X().StringFilter()), AutoLoad occur. It is right? We need RemoteFilter.

    here code example (index.chtml):

    
    @{
        Layout = null;
    }
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>ComboBox</title>
    </head>
    <body>
        @Html.X().ResourceManager().Theme(Theme.Gray)
        
        @(
            Html.X().Panel()
                .Bin(
                    Html.X().Store()
                        .PageSize(2)
                        .ID("storeGrd")
                        .RemotePaging(true)
                        .RemoteFilter(true)
                        .RemoteSort(true)
                        .AutoLoad(false)
                        .Proxy(
                            Html.X().AjaxProxy()
                                .Url("ReadData")
                                .Reader(
                                    Html.X().JsonReader().RootProperty("data")
                                )
                        )
                        .Model(Html.X().Model().Fields(
                                Html.X().ModelField().Name("Column1").Type(ModelFieldType.String),
                                Html.X().ModelField().Name("Column2").Type(ModelFieldType.String)
                            )
                        )          
                )
                .Items(
                        Html.X().GridPanel(new GridPanel.Config()
                        {
                            StoreID = "storeGrd"
                            , MinHeight = 200
                        })
                        .ID("grd")
                        .BottomBar(Html.X().PagingToolbar())
                        .Plugins(Html.X().GridFilters())
                        .ColumnModel(
                            Html.X().Column().Text("Column 1").DataIndex("Column1").Width(300).Filter(Html.X().StringFilter()),
                            Html.X().Column().Text("Column 2").DataIndex("Column2").Width(300)
                        )
                )
        )
    </body>
    </html>
            public ActionResult ReadData(StoreRequestParameters requestParameters)
            {
                var list = new List<object>();
                if (requestParameters.Start < 0)
                    return this.Store(new List<object>());
                list.Add(new { Column1 = "Column11", Column2 = "Column21" });
                list.Add(new { Column1 = "Column12", Column2 = "Column22" });
                list.Add(new { Column1 = "Column13", Column2 = "Column23" });
                return this.Store(list.AsQueryable().Skip(requestParameters.Start).Take(requestParameters.Limit), list.Count);
            }
  4. #4
    Hello @Andrey,

    I couldn't run your sample. Your ReadData method has a reference to this.Store that I am not really sure to what it should point. As your code is, that is not resolved and both references to this.Store do not work.
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hi,

    this.Store is the extended method of controller, added by Ext.Net, that method return StoreResult, you can replace it with:

    return new StoreResult(list.AsQueryable().Skip(requestParameters.Start).Take(requestParameters.Limit), list.Count);
    Here an example:
    http://mvc.ext.net/#/GridPanel_Pagin...orting/Remote/
  6. #6
    Thanks, it was most likely one mistake I've made while setting one of the sandbox Ext.NET solution, it happens. :)

    We'll take a look on the matter and return to you soon.
    Fabrício Murta
    Developer & Support Expert
  7. #7
    Thank you for the test case. Created an Issue:
    https://github.com/extnet/Ext.NET/issues/853

    Please try this as a fix.

    Fix
    Ext.data.AbstractStore.override({
        onFilterEndUpdate: function () {
            var me = this,
                suppressNext = me.suppressNextFilter;
    
            if (me.getRemoteFilter()) {
                me.getFilters().each(function (filter) {
                    if (filter.getInitialConfig().filterFn) {
                        Ext.Error.raise('Unable to use a filtering function in conjunction with remote filtering.');
                    }
                });
    
                me.currentPage = 1;
    
                if (!suppressNext && !(!me.isLoaded() && !me.getAutoLoad())) { // #853: added the condifition after "!suppressNext"
                    me.attemptLoad();
                }
            } else if (!suppressNext) {
                me.fireEvent('datachanged', me);
                me.fireEvent('refresh', me);
            }
    
            if (me.trackStateChanges) {
                me.saveStatefulFilters = true;
            }
    
            me.fireEvent('filterchange', me, me.getFilters().getRange());
        }
    });
    Last edited by Daniil; Aug 11, 2015 at 2:47 PM.
  8. #8

    It's helpful

    HI,

    thank you, it's help resolve a problem, I hope in future this will be removed
  9. #9
    Thank you for confirming.

    I've committed the fix in the revision 6511 (trunk). It will go to Ext.NET 3.2.1 release.

Similar Threads

  1. Replies: 0
    Last Post: Mar 13, 2014, 5:34 AM
  2. Replies: 5
    Last Post: Jul 19, 2012, 1:09 PM
  3. [CLOSED] Hidden="true" behaves as Visible="false"
    By marco.morreale in forum 2.x Premium Help
    Replies: 5
    Last Post: May 28, 2012, 4:17 PM
  4. Replies: 5
    Last Post: May 02, 2012, 6:37 PM
  5. [CLOSED] DropDownField with Grow="true" and GrowMax="xxx"
    By deejayns in forum 1.x Premium Help
    Replies: 4
    Last Post: Jan 12, 2012, 1:00 PM

Posting Permissions