I'm using the Excel Filtering for my columns. Problem is when I have loaded a large number of items with unique date/time stamps it takes too long to populate the Excel-style filter, instead I'd like just display the 'Available Filters' list. This Excel list feature is useful on the other columns that have a limited number of disctinct values, however.
My question is can I enable/disable the search list in Excel Filtering by column (enabled for some, disabled for others)?
My question is can I enable/disable the search list in Excel Filtering by column (enabled for some, disabled for others)?
3 Answers, 1 is accepted
0
Accepted
Hello John,
Thank you for writing.
Please consider the following code snippet, which demonstrates how to hide all elements in the popup, except the "Clear Filter" and the "Available Filters" items:
I hope that you find this information useful. Let us know if you have any other questions.
All the best,
Stefan
the Telerik team
Thank you for writing.
Please consider the following code snippet, which demonstrates how to hide all elements in the popup, except the "Clear Filter" and the "Available Filters" items:
void
radGridView1_FilterPopupRequired(
object
sender, Telerik.WinControls.UI.FilterPopupRequiredEventArgs e)
{
RadListFilterPopup popup = e.FilterPopup
as
RadListFilterPopup;
if
(popup !=
null
)
{
foreach
(RadMenuItemBase item
in
popup.Items)
{
if
(!(item
is
RadFilterOperationMenuItem) && !(item
is
RadMenuItem))
{
item.Visibility = ElementVisibility.Collapsed;
}
}
popup.Size =
new
Size(popup.Width, 50);
popup.SizingGrip.Visibility = ElementVisibility.Collapsed;
}
}
I hope that you find this information useful. Let us know if you have any other questions.
All the best,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
John
Top achievements
Rank 1
answered on 24 Apr 2012, 05:12 PM
Thanks for the response. My column that I'm attempting to filter is of type DateTimeOffset, which doesn't get the default CalendarPopUp for DateTime columns, which I'd prefer. I've tried overriding this default but I get a runtime error:
if
(e.Column.Name ==
"DetailTimeStamp"
)
{
e.FilterPopup =
new
RadDateFilterPopup(e.Column);
}
Using the 'List Filter' style and removing the 'search filter' works, but one thing to note is that it appears changing the height of the filter popup is 'sticky' for other columns and requires resetting - even for other grids on the form that I'm not handling this event. So I changed the code as displayed below and I'll need to handle the event on other grids on my form as well.
private
void
grdViewSbycLatencyDetail_FilterPopupRequired(
object
sender, FilterPopupRequiredEventArgs e)
{
RadListFilterPopup popup = e.FilterPopup
as
RadListFilterPopup;
if
(popup !=
null
&& e.Column.Name ==
"DetailTimeStamp"
)
{
foreach
(RadMenuItemBase item
in
popup.Items)
{
if
(!(item
is
RadFilterOperationMenuItem) && !(item
is
RadMenuItem))
{
item.Visibility = ElementVisibility.Collapsed;
}
}
popup.Size =
new
System.Drawing.Size(popup.Width, 50);
popup.SizingGrip.Visibility = ElementVisibility.Collapsed;
}
else
{
popup.Size =
new
System.Drawing.Size(popup.Width, 250);
popup.SizingGrip.Visibility = ElementVisibility.Collapsed;
}
}
0
Hi John,
Thank you for writing back.
Indeed, you cannot use the calendar popup, because its calendar and the rest of the options there are using DateTime as a type and comparison between DataTime and DateTimeOffset is not supported.
In regards to the popup size, you can work around this case by saving the initial popup size in a variable and use this variable for popup size, for columns different that the DateTimeOffset column:
I hope this helps.
Regards,
Stefan
the Telerik team
Thank you for writing back.
Indeed, you cannot use the calendar popup, because its calendar and the rest of the options there are using DateTime as a type and comparison between DataTime and DateTimeOffset is not supported.
In regards to the popup size, you can work around this case by saving the initial popup size in a variable and use this variable for popup size, for columns different that the DateTimeOffset column:
Size saveSize;
void
radGridView1_FilterPopupRequired(
object
sender, Telerik.WinControls.UI.FilterPopupRequiredEventArgs e)
{
e.FilterPopup =
new
RadListFilterPopup(e.Column);
RadListFilterPopup popup = e.FilterPopup
as
RadListFilterPopup;
if
(popup !=
null
)
{
if
(e.Column.Name ==
"DateColumn"
)
{
foreach
(RadMenuItemBase item
in
popup.Items)
{
if
(!(item
is
RadFilterOperationMenuItem) && !(item
is
RadMenuItem))
{
item.Visibility = ElementVisibility.Collapsed;
}
}
saveSize = popup.Size;
popup.Size =
new
Size(popup.Width, 50);
popup.SizingGrip.Visibility = ElementVisibility.Collapsed;
}
else
{
if
(saveSize != Size.Empty)
popup.Size = saveSize;
}
}
I hope this helps.
Regards,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>