[CLOSED] dynamic date filter not working

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] dynamic date filter not working

    I have added dynamic filter to grid which is dynamically created as below:
     DateFilter df = new DateFilter();
                    df.DataIndex = "MONTH_YEAR";
                    df.DatePickerOptions.TodayText = "Now";
                    df.Format = "MMM-yy";
                    gf.Filters.Add(df);
    I am binding the model field to store as :

      model.Fields.Add(new ModelField("MONTH_YEAR"));
    the date format it displays as : Aug-13, May-13

    But when i use the filter no record shows up. What am i missing.

    Also how do i customize the filter to only show Months on the date picker

    Thanks in advance
    Last edited by Daniil; Aug 15, 2013 at 10:35 AM. Reason: [CLOSED]
  2. #2
    Hi @PriceRightHTML5team,

    I think you should set up Type.Date for the ModelField.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @PriceRightHTML5team,

    I think you should set up Type.Date for the ModelField.
    I did that but still its not working . The date format i am showing on the grid is "MMM-yy"
    so it show as "Aug-13","Sept-13","Oct-13"... and so on.

    How do i customize the filter so that it filters records based on this format
  4. #4
    Please provide a full test case.
  5. #5
    Quote Originally Posted by Daniil View Post
    Please provide a full test case.
    @( X.Panel().Collapsed(false).ID("pnlPriceTrendTabular")
    
                    .Height(400)
                     .DefaultAnchor("100%")
                    .Layout(LayoutType.Fit)
                    .AutoScroll(true)
                    .Control(item => this.Initchart(item))
    
             )
    Below is the MVC code

    @functions{
     private void Initchart(Panel pnlGrafico)
        {
      Ext.Net.GridPanel grid = new GridPanel()
            {
                ID = "gridSnapshotTab",
                Layout = "Container",
                Scroll = ScrollMode.Both,
                ForceFit = false,
                AutoScroll = true,
                ColumnLines = true,
                EmptyText = "No data found"
            };
    var result = svc.getData();
    
     Store store = new Store();
            store.ID = "StoreTabView";
            var model = new Model();
    
    model.Fields.Add(new ModelField("MONTH_YEAR",ModelFieldType.Date));
      model.Fields.Add(new ModelField("CountryName"));
    
          store.Model.Add(model);
            store.Data = result;
            store.LoadData(result);
    
       grid.Store.Add(store);
    
    grid.ColumnModel.Add(new DateColumn() {
                                Text = "Month",
                                DataIndex = "MONTH_YEAR",                         
                                Format = "MMM-yy"
                            });
      grid.ColumnModel.Add(new Column()
                    {
                        Text = "Country",
                        DataIndex = "CountryName"
                    });
    
       GridFilters gf = new GridFilters();
            gf.Local = true;
    
     DateFilter df = new DateFilter();
                    df.DataIndex = "MONTH_YEAR";
                    df.DatePickerOptions.TodayText = "Now";
                    df.Format = "MMM-yy";
                    //df.Type = FilterType.Date;
                    gf.Filters.Add(df);
     gf.Filters.Add(new StringFilter() { DataIndex = "CountryName" });
    grid.Features.Add(gf);      
           
            pnlGrafico.Items.Add(grid);
    }
    }
  6. #6
    Thank you.

    It appears to be working as expected for me.

    What are the steps to reproduce the issue using the test case?

Similar Threads

  1. Gridpanel multiheader From To date filter
    By nomz in forum 2.x Help
    Replies: 4
    Last Post: Oct 26, 2012, 10:39 AM
  2. [CLOSED] GridPanel Column Filter - Date from-to ?
    By sisa in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 10, 2012, 1:20 PM
  3. Replies: 1
    Last Post: Apr 13, 2012, 1:52 PM
  4. Add date range grid filter
    By stone216 in forum 1.x Help
    Replies: 12
    Last Post: May 24, 2010, 5:32 PM
  5. [CLOSED] Date Filter in GridPanel
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 27, 2009, 10:27 AM

Tags for this Thread

Posting Permissions