Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
585
How to make a filter item checked as a condition for Date Column at runtime?
posted

Hi,

Background: We had a ultragrid to show a list of records, all columns are enabled AllowFilter. There is a column in Date type, we want to control its filter conditions in a rule, but not by its default. We just added the compared value as a new FilterCondition by below code:

FilterConditionsCollection filters = mGrid.DisplayLayout.Bands[0].ColumnFilters[col].FilterConditions;
if (mFilteringNonBlanksColumns.Contains(col.Key) && !string.IsNullOrEmpty(colValue))
{
if (col.DataType == typeof(DateTime))
{
filters.Add(new FilterCondition(FilterComparisionOperator.Equals, cellDate));
}
else
{
filters.Add(new FilterCondition(FilterComparisionOperator.Equals, colValue));
}
}

If the column is non-date column, it works well. I mean, the new added condition is CHECKED in the filter dropdown list, but, if it's a date column, it won't be checked, though it really filtered out the corresponding rows.

Hope it is clear for you understanding. 

Question: What should I do to realize adding a new FilterCondition to date column, and make sure it's checked in the filter dropdown list as well?

NOTE: In your library, you use a type DateHierarchyFilterOperand to be the filter operand by default, and the type is private. Then I just created our own filteroperand like it, but, it would make all the filter conditions unchecked in the filter dropdown list.

Thanks

Daniel Chen

Parents
  • 469350
    Offline posted

    Hi Daniel,

    The dropdown for the FilterUIProvider will only check a year in response to a FilterCondition of type DateHierarchyFilterOperand. As you pointed out, this class is internal. So there's currently no way for you to do what you are trying to achieve.

    This seems to be something of an oversight on our part and I think it's something we need to look into further.

    I have opened a private case for you so that I can link it to an internal development issue. This way you will be notified automatically when the dev issue is updated. The case number is CAS-152021-G4M8X3. You will see it here: https://www.infragistics.com/my-account/support-activity

    Let me know if you have any questions regarding this matter.   

     

Reply Children