[CLOSED] How can I clean the icon and filter for GridFilter ?

  1. #1

    [CLOSED] How can I clean the icon and filter for GridFilter ?

    Hi Community !

    Please check the code sample below:

    
    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="System.Collections.Generic" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Ext.Net.Node theNode = new Ext.Net.Node();
                theNode.NodeID = "root";
                theNode.Expanded = true;
    
                TreePanel1.Root.Add(theNode);
    
                Ext.Net.Node theNodeBlue = new Node();
                theNodeBlue.Text = "America";
                theNodeBlue.NodeID = "Am";
                theNodeBlue.Icon = Icon.Page;
                theNodeBlue.Leaf = true;
    
                theNode.Children.Add(theNodeBlue);
    
                Ext.Net.Node theNodeRed = new Node();
                theNodeRed.Text = "Europe";
                theNodeRed.NodeID = "Eu";
                theNodeRed.Icon = Icon.Page;
                theNodeRed.Leaf = true;
    
                theNode.Children.Add(theNodeRed);
            }
       }
    
        [DirectMethod]
        public void TreePanel1_ItemClick(string pstrId)
        {
            try
            {
                switch (pstrId)
                {
                    case "Am":
                        this.Store1.DataSource = new object[]
                        {
                            new object[] { 1, "Argentina", "LightBlue/White"},
                            new object[] { 2, " Bolivia", "Yellow/Green/Red"},
                            new object[] { 3, "Brazil", "Yellow/Green/Blue" },
                            new object[] { 4, "Chile", "Red/White/Blue"},
                             new object[]{ 5, "Colombia", "Red/White/Blue"},
                        };
    
                        this.Store1.DataBind();
                        break;
    
                    case "Eu":
                        this.Store1.DataSource = new object[]
                        {
                            new object[] { 1, "Spain", "Yellow/Red"},
                            new object[] { 2, "France", "Blue/White/Red"},
                            new object[] { 3, "Italy", "Green/White/Red" },
                            new object[] { 4, "Germany", "Black/Red/Yellow"},
                            new object[] { 5, "Greece", "Blue/White" },
                        };
    
                        this.Store1.DataBind();
                        break;
                }
                
                Store1.ClearFilter();
                Store1.Filters.Clear();
                Store1.Sorters.Clear();
            }
            catch (Exception)
            {
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    
    <head id="Head1" runat="server">
        <title>GridPanel with Local Filtering, Sorting and Paging - Ext.NET Examples</title>
    </head>
    
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            <ext:Viewport ID="ViewPort1" runat="server" Layout="BorderLayout">
                <Items>
    
                    <ext:FormPanel ID="FormPanel1" runat="server" 
                            MarginSpec="0 0 5 5"
                            Width="300"
                            Region="West"
                            Split="true"
                            Collapsible="true"
                            Title="FormPanel1">
                        <Items>
                            <ext:TreePanel ID="TreePanel1" runat="server"
                                    MarginSpec="0 0 0 0"
                                    AutoScroll="true"
                                    Frame="true"
                                    Flex="1"
                                    RootVisible="true">
                                <Listeners>
                                    <ItemClick Handler="App.direct.TreePanel1_ItemClick(record.data.id)"></ItemClick>
                                </Listeners>
                            </ext:TreePanel>
                        </Items>
                    </ext:FormPanel>
                    
                    <ext:GridPanel ID="GridPanel1" runat="server"
                            Title="Country List"
                            LockText="Bloquear"
                            UnlockText="Desbloquear"
                            MarginSpec="0 5 5 0"
                            SelectionMemory="false"
                            ForceFit="true"
                            Region="Center"
                            Border="False"
                            Frame="true"
                            EnableColumnHide="true">
                        <Store>
                            <ext:Store ID="Store1" runat="server" PageSize="10">
                                <Model>
                                    <ext:Model ID="Model1" runat="server" IDProperty="ID">
                                        <Fields>
                                            <ext:ModelField Name="ID" />
                                            <ext:ModelField Name="Country" />
                                            <ext:ModelField Name="Colour" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
    
                        <Plugins>
                            <ext:GridFilters ID="GridFilters1" runat="server" />
                        </Plugins>
    
                        <ColumnModel ID="ColumnModel1" runat="server">
                            <Columns>
                                <ext:Column ID="Column1" runat="server" Text="Country" Width="160" DataIndex="Country" Flex="1">
                                    <Filter>
                                        <ext:StringFilter DataIndex="Country" />
                                    </Filter>
                                </ext:Column>
    
                                <ext:Column ID="Column2" runat="server" Text="Flag's Colour" DataIndex="Colour" Flex="1" >
                                    <Filter>
                                        <ext:StringFilter DataIndex="Colour" />
                                    </Filter>
                                </ext:Column>
                            </Columns>
                        </ColumnModel>
    
                    </ext:GridPanel>
    
                </Items>
            </ext:Viewport>
        </form>
      </body>
    </html>
    How can I clean the icon and filter for GridFilter? I’ve implemented a simple example, to explain my issue.

    Step 1. Select TreePanel Element
    Step 2. For the Flag's Color column, filter by "white"
    Step 3. Select another element of the TreePanel

    Expected result:
    That all records are displayed.
    Trigger icon not shown
    Filter field is clean

    Obtained result:
    All records are displayed.
    Trigger icon is being displayed
    Filter field maintains value and keep boldface type


    [IMAGE]

    Click image for larger version. 

Name:	GridPanel with GridFilters.JPG 
Views:	49 
Size:	32.8 KB 
ID:	25085

    [/ IMAGE]

    I accept suggestions ideas or comments

    Note: Most applications maintain the same format and logic.

    Thanks in advance!
    Last edited by fabricio.murta; Nov 27, 2017 at 5:54 PM.
  2. #2
    Hello Mauricio!

    The example below explores the feature, see how it clears filters thru the button by calling the grid panel's clear filter method (button "Clear Filters"'s handler).
    - Grid Panel - Plugins - GridFilters Local

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi Fabricio !!

    Thank you very much for your quick response, I've checked the example you sent me, it works but fix 50% of the issue ... I would like to know if it is feasible clean the value entered in the filter ?

    Again thanks

    Saludos
    Mauricio
  4. #4
    Hello Mauricio!

    Sorry for that, for the other 50% of the matter, you can force-clear the last active filter value by clearing column's filter value. This seems to work fine. I'm afraid this is quite low-level so it is not exported to c# space. The javascript to clear the column filter field's value would be:

    App.Column1.filter.filter.setValue('');
    Assuming we are calling this after clearing the first column in your example.

    This is a client-side command you can send from server if you do a X.AddScript() like this:

    X.AddScript("App.CompanyColumn.filter.filter.setValue('');");
    I hope this helps!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hi FabrÃ*cio !!

    Thanks a lot for your reply.

    Please close the thread.

    Saludos
    Mauricio.
  6. #6
    Thanks for the feedback! I hope this helped you solve the issue!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 2
    Last Post: Oct 03, 2014, 10:14 AM
  2. [CLOSED] GridFilter unchecked, but filter still applied
    By ecko in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Mar 10, 2012, 2:35 PM
  3. [CLOSED] GridFilter Remote ComboBox filter
    By kenanhancer in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 17, 2011, 3:20 PM
  4. [CLOSED] Dynamically set filter value in GridFilter
    By jchau in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 05, 2010, 2:58 PM
  5. GridFilter, Alter name of filter
    By flaviodamaia in forum 1.x Help
    Replies: 0
    Last Post: Jun 05, 2009, 11:39 AM

Posting Permissions