[OPEN] [#1366] ListFilter sorting for GridFilters plugin

  1. #1

    [OPEN] [#1366] ListFilter sorting for GridFilters plugin

    Is there any config to sort options for ListFilter?

    Here is an example that the Company options, which orders same as data.

    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="System.Collections.Generic" %>
    <script runat="server">
    
        protected void Page_Load(object sender, EventArgs e)
        {
    
            StoreData.DataSource = new List<object>
                {
                    new
                    {
                        Id = 1,
                        Company = "ZZZ Co",
                    },
                    new
                    {
                        Id = 2,
                        Company = "Aloca Inc",
                    },
                    new
                    {
                        Id = 3,
                        Company = "Altria Group Inc",
                    },
                    new
                    {
                        Id = 4,
                        Company = "American Express Company",
                    },
                    new
                    {
                        Id = 5,
                        Company = "American International Group Inc.",
                    }
                };
    
            StoreData.DataBind();
        }
    
    </script>
    
    
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        
      
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:Window
                runat="server"
                Width="700"
                Height="400"
                Title="Example"
                Layout="Fit">
                <Items>
                    <ext:GridPanel ID="GridPanel1" runat="server" Border="false">
                        <Store>
                            <ext:Store
                                ID="StoreData"
                                runat="server"
                                PageSize="10">
                                <Model>
                                    <ext:Model runat="server" IDProperty="Id">
                                        <Fields>
                                            <ext:ModelField Name="Id" Type="Int" />
                                            <ext:ModelField Name="Company" Type="String" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                        <ColumnModel runat="server">
                            <Columns>
                                <ext:Column runat="server" Text="ID" DataIndex="Id">
                                    <Filter>
                                        <ext:NumberFilter />
                                    </Filter>
                                </ext:Column>
                                <ext:Column ID="CompanyColumn" runat="server" Text="Company" DataIndex="Company">
                                    <Filter>
                                        <ext:ListFilter />
                                    </Filter>
                                </ext:Column>
                            </Columns>
                        </ColumnModel>
                        <Plugins>
                            <ext:GridFilters runat="server" />
                        </Plugins>
                        <BottomBar>
                            <ext:PagingToolbar runat="server" />
                        </BottomBar>
                    </ext:GridPanel>
                </Items>
            </ext:Window>
        </form>
    </body>
    </html>
    Last edited by fabricio.murta; Aug 05, 2016 at 6:26 AM.
  2. #2
    Hello @kwcitadmin!

    Sorry for the delay, for some reason I didn't see your post, so it took some time until my mistake was found!

    Well, bad news is that sorting the list in the list filter is not supported without some change.

    Good news is that it is not really difficult to implement support on your page:

    <script type="text/javascript">
        Ext.define('Ext.grid.filters.filter.List', {
            override: 'Ext.grid.filters.filter.List',
            createListStore: function (options) {
                var me = this;
    
                me.callParent(arguments);
    
                if (me.store) {
                    me.store.sort('text');
                }
            }
        })
    </script>
    I hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    My premium support was just resumed and the post was moved by Geoffrey.

    Thx for your prompt reply. Really impressed!
  4. #4
    Sorting is nice for some cases while custom order is useful for other cases, e.g. size in following sample https://examples4.ext.net/#/GridPane...Filters_Local/ .

    It would be nice if a config could be added to ListFilter in later version :)
  5. #5
    Hello again, @kwcitadmin!

    Alright, you got it. We've logged a feature issue to implement this on Ext.NET under ID #1366.

    This is not so simple and straightforward to just implement it because, as a full-fledged ExtJS component, making changes our side may mean conflicts in the future, may Sencha implement this feature on their side, so careful logging and tracking is needed once anything fully implemented in ExtJS is changed.

    If that was an exclusive Ext.NET feature, that would be easier to just go ahead and implement.

    With the feature logged now we can also track whether other users are demanding such a feature and prioritize what's most missed in the framework! We hope you understand.
    Fabrício Murta
    Developer & Support Expert
  6. #6
    thx.
    Look forward to the good news!

Similar Threads

  1. [CLOSED] GridFilters - ListFilter Problem
    By opendat2000 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 12, 2014, 8:00 PM
  2. Replies: 1
    Last Post: Feb 10, 2014, 1:05 PM
  3. [CLOSED] Update GridFilters ListFilter Store Server-Side
    By jwhitmire36 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 23, 2013, 2:44 PM
  4. [CLOSED] GridFilters feature messes with Paging/Sorting?
    By vadym.f in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Jul 15, 2013, 11:34 AM

Tags for this Thread

Posting Permissions