[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 5: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, 11:12 AM
  2. Replies: 0
    Last Post: Jun 17, 2013, 11:05 AM
  3. [CLOSED] Grid Filters Dynamic
    By majunior in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 18, 2011, 3:49 PM
  4. Replies: 0
    Last Post: Mar 04, 2011, 12:05 PM
  5. Dynamic Filters not showing...
    By rthiney in forum 1.x Help
    Replies: 1
    Last Post: Nov 18, 2009, 6:31 PM

Posting Permissions