FlexGrid restore FilterDefinition state

Posted by: 048alexsandr1992 on 26 April 2018, 8:51 pm EST

  • Posted 26 April 2018, 8:51 pm EST

    Hi,

    I have problem with restoring filter state.

    For Example:

    I have next .cshtml configuration for filters

    
     .Filterable(f =>
            {
                f.DefaultFilterType(FilterType.Condition)
                .ColumnFilters(cfsb =>
                {
                    cfsb.Add(cfb => cfb.Column("Id").FilterType(FilterType.None));
    
                    foreach (var item in Model.GetFilterTypes())
                    {
                        cfsb.Add(cfb => cfb.Column(item.Key).FilterType(item.Value));
                    }
                });
            }
    
    

    You can see that for column “Id” filterType is set to non.

    from javascript I see that it is true;

    http://joxi.ru/82QNjwvH1EqJdA

    I restore filter state such as in this link

    http://demos.componentone.com/ASPNET/LearnMvcClient/C1FlexGrid/PersistingState

    But when I set filterDefinition all settings in razor view is clear

    http://joxi.ru/V2Vg6wjH0bLnMA

    what wrong?

  • Posted 26 April 2018, 9:13 pm EST

    I will add,

    before set filterDefinition column look correctly

    http://joxi.ru/EA4ZdlVtD3GWKm

    but after set filterDefinition filter appears at the field “Id”

    http://joxi.ru/D2P0gwvHd049X2

  • Posted 29 April 2018, 6:29 pm EST

    Hi Alex,

    The filterDefinition contains only the Active Filter definition. You need to reset filter on loading Definition with Client Approach. Please refer to the following code snippet:

     function resetDef() {
            var def = localStorage.getItem("filter");
            filter.filterDefinition = def;
            filter.getColumnFilter(theGrid.columns.getColumn("ID")).filterType = 0;
        }
    

    Or set the filter.filterColumns array. Please refer to the following code snippet:

    theGrid = wijmo.Control.getControl('#flexGrid');
           filter = c1.getExtender(theGrid, "filter");
           filter.filterColumns = ["Name", "Country", "Hired"];
    

    ~Manish

  • Posted 1 May 2018, 5:10 pm EST

    Hi

    It’s not universal solution. For example:

    f.DefaultFilterType(FilterType.Condition)
    

    and one of columns have filter type FilterType.Value.

    I selected some items in this filter, reload page, and look the filter state after reload.

    When I set filterDefinition, than filter type FilterType.Value was reset to FilterType.Condition.

    But if I use

    
     function resetDef() {
            var def = localStorage.getItem("filter");
            filter.filterDefinition = def;
            filter.getColumnFilter(theGrid.columns.getColumn("Country")).filterType = 2;
        }
    
    

    than filterDefinition will be reseted.

    there was a circle.

  • Posted 2 May 2018, 3:11 pm EST

    Hi Alex,

    We are sorry, we are unable to replicate the issue with MVC build 4.0.20181.150(latest). Please find the attached sample used to replicate the issue at our end.

    Please modify the attached sample to replicate the issue at our end.

    ~Manish

  • Posted 2 May 2018, 3:12 pm EST

  • Posted 3 May 2018, 9:14 pm EST

    Hi

    I upload sample with issue in file-sharing service

    http://dropmefiles.com/9hQhd

  • Posted 9 May 2018, 3:30 pm EST

    Hi Alex,

    We are extremely sorry for the delayed response.

    We are able to replicate the issue at our end. It seems a bug, hence this issue has been forward to the concerned team for further investigation with tracking id 321627.

    We will let you know as we get any update on this.

    ~Manish

  • Posted 9 May 2018, 5:29 pm EST

    Hi, thanks

    I will be glad to help make the product better

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels