Excel-like filter OnClientItemCheckedHandler

2 posts, 0 answers
  1. Jas
    Jas avatar
    4 posts
    Member since:
    Apr 2015

    Posted 15 Aug 2017 Link to this post

    Hi,

    I would like to call a JavaScript function whenever an item is checked/unchecked in the excel-like filter list.

    Please assist with an example of how this could be achieved.

    Thank you,

    Jas

  2. Eyup
    Admin
    Eyup avatar
    3825 posts

    Posted 18 Aug 2017 Link to this post

    Hi Jas,

    You can achieve this requirement using the following approach:
    protected void RadGrid1_FilterCheckListItemsRequested(object sender, GridFilterCheckListItemsRequestedEventArgs e)
    {
        e.ListBox.DataBind();
     
        foreach (RadListBoxItem item in e.ListBox.Items)
        {
            item.Attributes.Add("onclick", "filterListBoxItemClicked(this,event);");
        }
    }
    JavaScript:
    function filterListBoxItemClicked(el, event) {
        if (event.target && event.target.type == "checkbox" && event.target.checked) {
            alert($(el).text());
        }
    }

    I hope this will prove helpful.

    Regards,
    Eyup
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top