[CLOSED] Add Dynamic Filters to Dynamic Gridpanel

  1. #1

    [CLOSED] Add Dynamic Filters to Dynamic Gridpanel

    Hi guys,

    Fresh back from almost 2 months traveling in Australia, but have to work again :(

    Trying to add gridfilters to a dynamic filter. Created a small example.
    Filters are not appearing....any help appreciated :)

    aspx
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FleetWise.Test.Default" %>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Dynamic test</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
         <ext:ResourceManager ID="rmOverzichten" runat="server" CleanResourceUrl="false" />
        <ext:GridPanel runat="server" ID="dgvGrid">
            <Store>
                <ext:Store runat="server" ID="dgvStore">
                    <Model>
                        <ext:Model runat="server"/>
                    </Model>
                </ext:Store>
            </Store>
        </ext:GridPanel>
     
        <ext:Button runat="server" Text="Fill grid" OnDirectClick="btn_click"></ext:Button>
    
    
        </div>
        </form>
    </body>
    </html>
    c#
    using System;
    using Ext.Net;
    
    
    namespace FleetWise.Test
    {
        public partial class Default : System.Web.UI.Page
        {
            protected void btn_click(object sender, DirectEventArgs e)
            {
                dgvStore.AddField(new ModelField("Text", ModelFieldType.String));
                dgvStore.AddField(new ModelField("DateTime", ModelFieldType.Date));
                dgvGrid.ColumnModel.Columns.Add(new Column()
                {
                    DataIndex = "Text",
                    Text = "Text Column"
                });
    
    
                dgvGrid.ColumnModel.Columns.Add(new Column()
                {
                    DataIndex = "DateTime",
                    Text = "Date Column"
                });
    
    
                
                // Trying to add filters to grid
                GridFilters gf = new GridFilters();
                
                StringFilter sf = new StringFilter();
                sf.DataIndex = "Text";
                gf.Filters.Add(sf);
    
    
                DateFilter df = new DateFilter();
                df.DataIndex = "DateTime";
                gf.Filters.Add(df);
    
    
                dgvGrid.Features.Add(gf);
                // END
    
    
                dgvGrid.Reconfigure();
                dgvStore.RebuildMeta();
                dgvStore.DataSource = new[]
                                      {
                                          new
                                              {
                                                  Text = "Text1",
                                                  DateTime = DateTime.Now
                                              },
                                          new
                                              {
                                                  Text = "Text2",
                                                  DateTime = DateTime.Now
                                              }
                                      };
                dgvStore.DataBind();
    
    
    
    
            }
        }
    }

    Martin
    Last edited by Daniil; Aug 22, 2014 at 6:24 AM. Reason: [CLOSED]
  2. #2
    Hi Martin,

    I would like to visit Australia ever as well:)

    A GridPanel's .Reconfigure() can reconfigure columns and store, that is it.

    To add filters to a GridFilters plugin on the fly, you are going to rerender a GridPanel at all.
  3. #3
    Great country...friendly people..beautiful nature. Little bit expensive though, but it was worth it.

    Rerender ? Can you eidt this small example to get it working ? :)

    I've tried gridpanel.ReRender() instead of reconfigure, but still no filters..

    Martin
  4. #4
    Nice. I am packing:)

    I've just replaced
    dgvGrid.Reconfigure();
    with
    dgvGrid.ReRender();
    and that is the only thing I've done. The filters appear for me.

    Could you, please, provide a test case to reproduce?
  5. #5
    mmmm... sorry.. my bad..

    You're right. Works like a charm.

    Thanks !

    Martin

Similar Threads

  1. Replies: 4
    Last Post: Sep 17, 2013, 12:12 PM
  2. Replies: 0
    Last Post: Jun 17, 2013, 12:05 PM
  3. [CLOSED] Grid Filters Dynamic
    By majunior in forum 1.x Premium Help
    Replies: 3
    Last Post: Apr 18, 2011, 4:49 PM
  4. Replies: 0
    Last Post: Mar 04, 2011, 1:05 PM
  5. Dynamic Filters not showing...
    By rthiney in forum 1.x Help
    Replies: 1
    Last Post: Nov 18, 2009, 7:31 PM

Posting Permissions