[CLOSED] FilterHeader plugin doesn't work when you set the locked="true" on the column

  1. #1

    [CLOSED] FilterHeader plugin doesn't work when you set the locked="true" on the column

    Hi,

    in the following example if I set the locked="true" for column ID the filterHeader plugin doesn't work
    also buttons in DockedItems doesn't work.
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.Store1.DataSource =  new List<object>
                                {
                                    new
                                        {
                                            Id = 1,
                                            Price = 71.72,
                                            Company = "3m Co",
                                            Date = new DateTime(2007, 9, 1),
                                            Size = "large",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 2,
                                            Price = 29.01,
                                            Company = "Aloca Inc",
                                            Date = new DateTime(2007, 08, 01),
                                            Size = "medium",
                                            Visible = false
                                        },
                                    new
                                        {
                                            Id = 3,
                                            Price = 83.81,
                                            Company = "Altria Group Inc",
                                            Date = new DateTime(2007, 08, 03),
                                            Size = "large",
                                            Visible = false
                                        },
                                    new
                                        {
                                            Id = 4,
                                            Price = 52.55,
                                            Company = "American Express Company",
                                            Date = new DateTime(2008, 01, 04),
                                            Size = "extra large",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 5,
                                            Price = 64.13,
                                            Company = "American International Group Inc.",
                                            Date = new DateTime(2008, 03, 04),
                                            Size = "small",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 6,
                                            Price = 31.61,
                                            Company = "AT&T Inc.",
                                            Date = new DateTime(2008, 02, 01),
                                            Size = "extra large",
                                            Visible = false
                                        },
                                    new
                                        {
                                            Id = 7,
                                            Price = 75.43,
                                            Company = "Boeing Co.",
                                            Date = new DateTime(2008, 01, 01),
                                            Size = "large",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 8,
                                            Price = 67.27,
                                            Company = "Caterpillar Inc.",
                                            Date = new DateTime(2007, 12, 03),
                                            Size = "medium",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 9,
                                            Price = 49.37,
                                            Company = "Citigroup, Inc.",
                                            Date = new DateTime(2007, 11, 24),
                                            Size = "large",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 10,
                                            Price = 40.48,
                                            Company = "E.I. du Pont de Nemours and Company",
                                            Date = new DateTime(2007, 05, 09),
                                            Size = "extra large",
                                            Visible = false
                                        },
                                    new
                                        {
                                            Id = 11,
                                            Price = 68.1,
                                            Company = "Exxon Mobile Corp",
                                            Date = new DateTime(2007, 12, 12),
                                            Size = "large",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 12,
                                            Price = 34.14,
                                            Company = "General Electric Company",
                                            Date = new DateTime(2008, 06, 16),
                                            Size = "extra large",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 13,
                                            Price = 30.27,
                                            Company = "General Motors Corporation",
                                            Date = new DateTime(2006, 12, 07),
                                            Size = "medium",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 14,
                                            Price = 36.53,
                                            Company = "Hewlett-Packard Co.",
                                            Date = new DateTime(2007, 05, 13),
                                            Size = "large",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 15,
                                            Price = 38.77,
                                            Company = "Honweywell Intl Inc",
                                            Date = new DateTime(2006, 11, 07),
                                            Size = "medium",
                                            Visible = false
                                        },
                                    new
                                        {
                                            Id = 16,
                                            Price = 19.88,
                                            Company = "Intel Corporation",
                                            Date = new DateTime(2007, 01, 09),
                                            Size = "small",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 17,
                                            Price = 81.41,
                                            Company = "International Business Machines",
                                            Date = new DateTime(2005, 01, 21),
                                            Size = "extra large",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 18,
                                            Price = 64.72,
                                            Company = "Johnson & Johnson",
                                            Date = new DateTime(2008, 01, 10),
                                            Size = "extra large",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 19,
                                            Price = 45.73,
                                            Company = "JP Morgan & Chase & Co",
                                            Date = new DateTime(2008, 02, 20),
                                            Size = "large",
                                            Visible = false
                                        },
                                    new
                                        {
                                            Id = 20,
                                            Price = 36.76,
                                            Company = "McDonald's Corporation",
                                            Date = new DateTime(2007, 06, 12),
                                            Size = "large",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 21,
                                            Price = 27.96,
                                            Company = "Pfizer Inc",
                                            Date = new DateTime(2007, 12, 30),
                                            Size = "small",
                                            Visible = false
                                        },
                                    new
                                        {
                                            Id = 22,
                                            Price = 45.07,
                                            Company = "The Coca-Cola Company",
                                            Date = new DateTime(2007, 01, 30),
                                            Size = "medium",
                                            Visible = false
                                        },
                                    new
                                        {
                                            Id = 23,
                                            Price = 34.64,
                                            Company = "The Home Depot, Inc",
                                            Date = new DateTime(2006, 12, 31),
                                            Size = "small",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 24,
                                            Price = 61.91,
                                            Company = "The Procter & Gamble Company",
                                            Date = new DateTime(2007, 04, 08),
                                            Size = "extra large",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 25,
                                            Price = 63.26,
                                            Company = "United Technologies Corporation",
                                            Date = new DateTime(2006, 06, 04),
                                            Size = "medium",
                                            Visible = true
                                        },
                                    new
                                        {
                                            Id = 26,
                                            Price = 35.57,
                                            Company = "Verizon Communications",
                                            Date = new DateTime(2005, 07, 09),
                                            Size = "small",
                                            Visible = false
                                        },
                                    new
                                        {
                                            Id = 27,
                                            Price = 45.45,
                                            Company = "Wal-Mart Stores, Inc",
                                            Date = new DateTime(2006, 09, 09),
                                            Size = "large",
                                            Visible = true
                                        }
                                };
                this.Store1.DataBind();
            }
        }
    
        protected Field OnCreateFilterableField(object sender, ColumnBase column, Field defaultField)
        {
            if(column.DataIndex == "Id")
            {
                ((TextField)defaultField).Icon = Icon.Magnifier;
            }
            
            return defaultField;
        }
    </script>
    
    <!DOCTYPE html>
        
    <html>
    <head runat="server">
        <title>FilterHeader plugin overview - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    
        <script>
            var loadFilter = function (plugin) {
                plugin.setValue({
                    Id : ">5",
                    Company: "!Inc.",
                    Price: ">50<70",
                    Visible: 1
                });
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
        
            <h1>FilterHeader plugin overview</h1> 
                
            <ext:Window 
                ID="Window1" 
                runat="server"         
                Width="800" 
                Height="400" 
                Closable="false"
                Title="Example" 
                Maximizable="true"
                Layout="Fit">
                <Items>
                    <ext:GridPanel runat="server">
                        <Store>
                            <ext:Store ID="Store1" runat="server" PageSize="10">
                                <Model>
                                    <ext:Model runat="server" IDProperty="Id">
                                        <Fields>
                                            <ext:ModelField Name="Id" Type="Int" />
                                            <ext:ModelField Name="Company" Type="String" />
                                            <ext:ModelField Name="Price" Type="Float" />
                                            <ext:ModelField Name="Date" Type="Date" />
                                            <ext:ModelField Name="Size" Type="String" />
                                            <ext:ModelField Name="Visible" Type="Boolean" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                                <Sorters>
                                    <ext:DataSorter Property="Company" Direction="ASC" />
                                </Sorters>        
                            </ext:Store>
                        </Store>
                        <ColumnModel runat="server">
                            <Columns>
                                <ext:Column runat="server" Text="ID" DataIndex="Id" Locked="true"/>
                                <ext:Column runat="server" Text="Company" DataIndex="Company" Flex="1" />
                                <ext:Column runat="server" Text="Price" DataIndex="Price">
                                    <Renderer Format="UsMoney" />
                                </ext:Column>
                                <ext:DateColumn runat="server" Text="Date" DataIndex="Date" Align="Center" Format="yyyy-MM-dd" />
                                <ext:Column runat="server" Text="Size" DataIndex="Size" />
                                <ext:Column runat="server" Text="Visible" DataIndex="Visible" Align="Center">
                                    <Renderer Handler="return (value) ? 'Yes':'No';" />
                                </ext:Column>
                            </Columns>
                        </ColumnModel>
                        <Plugins>
                            <ext:FilterHeader runat="server" OnCreateFilterableField="OnCreateFilterableField" />
                        </Plugins>
                        <BottomBar>
                            <ext:PagingToolbar runat="server" HideRefresh="True">
                            </ext:PagingToolbar>
                        </BottomBar>
                        <DockedItems>
                            <ext:Toolbar runat="server" Dock="Bottom">
                                <Items>
                                    <ext:Button 
                                        runat="server" 
                                        Text="Case Sensitive" 
                                        EnableToggle="true" 
                                        AllowDepress="true" 
                                        ToggleHandler="var plugin = this.up('grid').filterHeader; plugin.caseSensitive = this.pressed; plugin.applyFilter();" 
                                        />
                                    <ext:Button 
                                        runat="server" 
                                        Text="Load Filters" 
                                        Handler="loadFilter(this.up('grid').filterHeader);" 
                                        />                                
                                    <ext:Button 
                                        runat="server" 
                                        Text="Get Fields Values" 
                                        ToolTip="Get Values of Fields" 
                                        Handler="var values = Ext.encode(this.up('grid').filterHeader.getValue()); Ext.Msg.alert('Fields Values', values);" 
                                        />
                                    <ext:Button 
                                        runat="server" 
                                        Text="Get Filter Values" 
                                        ToolTip="Get Filter Values of Grid" 
                                        Handler="var filters = Ext.encode(this.up('grid').filterHeader.getFilterValues()); Ext.Msg.alert('Filter Values', filters);" 
                                        />
                                    <ext:Button 
                                        runat="server" 
                                        Text="Clear Filters" 
                                        Handler="this.up('grid').filterHeader.clearFilter();" 
                                        />
                                </Items>
                            </ext:Toolbar>
                        </DockedItems>                   
                    </ext:GridPanel>
                </Items>
            </ext:Window>
        </form>
    </body>
    </html>
    There is a way to fix the issue?
    Thank you.
    Last edited by Daniil; Nov 19, 2013 at 1:31 PM. Reason: [CLOSED]
  2. #2
    Hello!

    Thank you! We are investigating this issue.
  3. #3
    Try the following overriding:

    <script>
        Ext.override(Ext.net.FilterHeader, {
            init: function (grid) {
                this.grid = grid;
                grid.filterHeader = this;
                this.view = grid.getView();
                this.store = grid.store;
                this.fields = [];
                this.prevFilters = {};
                this.onFieldChange = Ext.Function.createBuffered(this.onFieldChange, this.updateBuffer, this);
    
                if (this.remote) {
                    this.store.on("before" + (this.store.buffered ? "prefetch" : "load"), this.onBeforeLoad, this);
                }
    
                this.view.on("viewready", this.initColumns, this);
                this.view.normalView.on("viewready", this.initColumns, this);
            }
        });
    </script>
  4. #4
    This has been fixed in the SVN trunk. Thank you for the report.
  5. #5
    Quote Originally Posted by Daniil View Post
    This has been fixed in the SVN trunk. Thank you for the report.
    I updated the version under SVN and it works now.
    Thank you so much.

Similar Threads

  1. [CLOSED] Store with SortOnLoad="true" doesn't seem to do anything.
    By michaeld in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 19, 2013, 6:06 AM
  2. [CLOSED] gridpanel Locked="true"
    By gs_user in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 08, 2013, 12:12 AM
  3. [CLOSED] Hidden="true" behaves as Visible="false"
    By marco.morreale in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: May 28, 2012, 3:17 PM
  4. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  5. [CLOSED] DropDownField with Grow="true" and GrowMax="xxx"
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 12, 2012, 12:00 PM

Posting Permissions