OnChange event and filter expression

2 posts, 0 answers
  1. Stefania
    Stefania avatar
    107 posts
    Member since:
    May 2013

    Posted 23 Jul 2014 Link to this post

    Hi
    this is my OnChenge function

    function OnChange(sender, args) {
                    if (sender.hasChanges()) {
                        var response;
                        if (sender.get_filterExpressions()._hasFilerEntries) {
                            response = sender.view();
                            alert("filter");
                        }
                        else
                            response = sender.get_data();  // args.get_items();
                        if (response) {
                            //DO SOMETHING
                        }
                    }
                }

    I would like to find only the records filtered if filters are filled, and all data if there are no filters
    Problems:
    1. If I have more pages in my grid, sender.view() return only data in the current page
    2. If I cancel text in my filter textbox and I press enter
    sender.get_filterExpressions()._hasFilerEntries
     is true

    thanks
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 28 Jul 2014 Link to this post

    Hello Stefania,

    1. Note that when the RadGrid is integrated with ClientDataSource control all the settings are applied at the same time and the sender.view() will return only the items that are presented on the current page. Therefore the only possible solution in this case is to disable the paging in order to get all the items.

    2. Note that _hasFilterEntries is a private variable and it is not for a public usage. The ClientDataSource is keeping the filter expressions used in the FilterExpressions collection. If you cancel the filtering the collection expectedly will not be changed. You could check the filter expressions number by using the get_count() method of the collection and if you need you could clear with with the "clear()" method.

    If this information does not help I would kindly ask you to elaborate a bit more on the exact scenario you have and the specific requirements you are aiming. Sending us your code will help further research on the case and provide proper solution.

    Regards,
    Maria Ilieva
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top