This is a migrated thread and some comments may be shown as answers.

OnChange event and filter expression

1 Answer 195 Views
ClientDataSource
This is a migrated thread and some comments may be shown as answers.
Stefania
Top achievements
Rank 2
Stefania asked on 23 Jul 2014, 08:58 AM
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

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 28 Jul 2014, 10:41 AM
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.

 
Tags
ClientDataSource
Asked by
Stefania
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Share this question
or