Removing "Or" option from filter

4 posts, 1 answers
  1. Aleks
    Aleks avatar
    23 posts
    Member since:
    Nov 2018

    Posted 25 Feb 2020 Link to this post

    If I have a column filter configured like this:-

     

                c.Bound(p => p.CreatedDateTime)
                    .Title("Created")
                    .Filterable(f => f
                        .Operators(o => o.ForDate(d => d.Clear().IsGreaterThanOrEqualTo("On or after").IsLessThan("Before")))
                        .UI(GridFilterUIRole.DateTimePicker)
                    )

     

    It shows a dropdown for "And" and "Or" between the two filter options. In my case, this doesn't make sense.

    Is there a way to specify the options or remove the dropdown?

  2. Answer
    Nikolay
    Admin
    Nikolay  avatar
    293 posts

    Posted 27 Feb 2020 Link to this post

    Hi Aleks,

    The "And"/"Or" DropDownList could be removed with custom logic on FilterMenuOpen Grid event. The logic would look like:

    .Events(e => e.FilterMenuOpen("onFilterMenuOpen"))
    ...
    
    <script>
        function onFilterMenuOpen(e) {
            if (e.field == "TimeLine") {
                e.container.find(".k-filter-and").hide();
            }
        }
    </script>

    Please try this and let me know if you have any questions.

    Regards,
    Nikolay
    Progress Telerik

    Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
  3. Aleks
    Aleks avatar
    23 posts
    Member since:
    Nov 2018

    Posted 27 Feb 2020 in reply to Nikolay Link to this post

    That works, thanks.
  4. Nikolay
    Admin
    Nikolay  avatar
    293 posts

    Posted 03 Mar 2020 Link to this post

    Hello Alex,

    I am glad to hear my suggestion helped you moving forward with this inquiry.

    This thread will now be closed. Please do not hesitate to contact us back if anything else arises.

    Regards,
    Nikolay
    Progress Telerik

    Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
Back to Top