2

I am not getting time filter properly, it displays calendar instead of time. however calendar should only be displays when date filter is selected. below is code for my view I have also attached image. I downloaded the sample source code from the following link https://gridmvc.codeplex.com/

View

@using GridMvc.Html
@using GridMvc.Sorting
@model IEnumerable<GridMvc.Site.Logging>

@Html.Grid(Model).Named("ordersGrid").Columns(columns =>
{
    /* Adding "OrderID" column: */

    columns.Add(o => o.ID)
           .Titled("Number")
           .SetWidth(100);
    columns.Add(o => o.DateTime, "Date")
            .Titled("Date")
            .SortInitialDirection(GridSortDirection.Descending)
            .Format("{0:dd/MM/yyyy}")
            .SetWidth(110);
    columns.Add(o => o.DateTime, "Time")
            .Titled("Time")
            .SortInitialDirection(GridSortDirection.Descending)
            .Format("{0:hh:mm tt}")                
            .SetWidth(110);        
    columns.Add(o => o.Type)
           .Titled("Type")
           .SetWidth(150)
           .ThenSortByDescending(o => o.ID);
           //.SetFilterWidgetType("CustomCompanyNameFilterWidget");
    columns.Add(o => o.Description)
           .Titled("Description")
           .SetWidth(250);
    columns.Add(o => o.Reference)
            .Titled("Reference")
            .SetWidth(150)
            .Css("hidden-xs"); //hide on phones
    columns.Add(o => o.Response)
            .Titled("Response")
            .SetWidth(150)
            .Css("hidden-xs"); //hide on phones        


}).WithPaging(15).Sortable().Filterable().WithMultipleFilters()

enter image description here

Hammad Bukhari
  • 459
  • 2
  • 11
  • 30

2 Answers2

0

Sir there is no feature for filtering time it is for on this datatypes. Grid.Mvc support several types of columns (specified in Add method):

System.String
System.Int32
System.Int64
System.Boolean
System.DateTime
System.Decimal
System.Byte
System.Double
System.Single

https://gridmvc.codeplex.com/wikipage?title=Filtering

Saineshwar Bageri - MVP
  • 3,851
  • 7
  • 41
  • 47
0

Probably too late, but it looks like you could create a custom filter:

https://gridmvc.codeplex.com/wikipage?title=Creating%20custom%20filter%20widget&referringTitle=Filtering (CodePlex is going away, but the documentation says a read-only archive will remain)

The default DateTime widget accepts times (e.g. grid-filter=OccurredAt__5__2017-05-17+17%3a20%3a00 for greater than May 17th 2017 at 17:20:00), but doesn't display a picker for them so you might be able to inherit from or copy/paste the default DateTime render and then just add a new JavaScript widget.

Still a reasonably large chunk of work to do.

Drew Delano
  • 1,421
  • 16
  • 21