This is a migrated thread and some comments may be shown as answers.

[Solved] Bug - Adding filter to nullable datetimediseable popup filter box

0 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dadv
Top achievements
Rank 1
Dadv asked on 18 Feb 2012, 12:14 AM
Hi,

I try to add a filter for a nullable datetime an found a strange behavior.

I had add the filter .Filters(f=>f.Add(a=>a.OrderDate).IsNotEqualTo(null))) to the  'Grid First Look' of the example  project :  


<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<OrderDto>>" %>
 
<asp:content contentplaceholderid="maincontent" runat="server">
<% using (Html.Configurator("The grid should...")
              .PostTo("FirstLook", "Grid")
              .Begin())
   { %>
    <ul>
        <li><%= Html.CheckBox("ajax", true, "make <strong>AJAX</strong> requests")%></li>
        <li><%= Html.CheckBox("grouping", true, "allow <strong>grouping</strong> of data")%></li>
        <li><%= Html.CheckBox("filtering", true, "allow <strong>filtering</strong> of data")%></li>
        <li><%= Html.CheckBox("paging", true, "have <strong>pages</strong> with 10 items")%></li>
        <li><%= Html.CheckBox("scrolling", true, "show a <strong>scrollbar</strong> when there are many items")%></li>
        <li><%= Html.CheckBox("sorting", true, "allow <strong>sorting</strong> of data")%></li>
        <li><%= Html.CheckBox("showFooter", true, "show footer")%></li>
    </ul>
    <button class="t-button" type="submit">Apply</button>
<% } %>
 
<%= Html.Telerik().Grid(Model)
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(o => o.OrderID).Width(100);
            columns.Bound(o => o.ContactName).Width(200);
            columns.Bound(o => o.ShipAddress);
            columns.Bound(o => o.OrderDate).Format("{0:MM/dd/yyyy}").Width(120);
        })
        .DataBinding(dataBinding =>
        {
            dataBinding.Server().Select("FirstLook", "Grid", new { ajax = ViewData["ajax"] });
            dataBinding.Ajax().Select("_FirstLook", "Grid").Enabled((bool)ViewData["ajax"]);
        })
        .Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
        .Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
        .Pageable(paging => paging.Enabled((bool)ViewData["paging"]))
        .Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"])
                                  .Filters(f=>f.Add(a=>a.OrderDate).IsNotEqualTo(null)))
        .Groupable(grouping => grouping.Enabled((bool)ViewData["grouping"]))
        .Footer((bool)ViewData["showFooter"])
%>
</asp:content>

the Filter work fine, the background color of the filter icon of the order date change like expected, but all the filter icon lose there 'clickability', 

I think it's because Nullable value is not accepted in the filter popup box for date (it will be great to add in the filter type list IsEqualToNull and IsNotEqualToNull and diseable the calendar textbox if this is choose).

Regards,
Tags
Grid
Asked by
Dadv
Top achievements
Rank 1
Share this question
or