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

setting a default value for the filter

7 Answers 110 Views
GridView
This is a migrated thread and some comments may be shown as answers.
aviv ron
Top achievements
Rank 1
aviv ron asked on 07 Feb 2010, 09:53 PM
i would like to assign a value to a columns filter programatically when the data is loading so that the user receives the grid already filtered. how can i do that?
another option would be to use the DomainDataSource filtering option but to sync it with the grids filter so that the user can see the grid is filtered (because when i set a filter to the domain data source there is no evidence on the grid for that)

7 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 08 Feb 2010, 07:03 AM
Hello,

Please check this post for more info.

Regards,
Vlad
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
aviv ron
Top achievements
Rank 1
answered on 18 Apr 2010, 02:30 PM
thanks, that works... but the filter icon does not reflect that there is a filter set.
is there a fix for this? i would like the user to understand that the column is filtered by default.
0
Rossen Hristov
Telerik team
answered on 19 Apr 2010, 11:47 AM
Hello aviv ron,

Do you update the IsActive property like shown in the blog post? This is what you should do in order to fill-up/empty the funnel icon.

I hope this helps.

Sincerely yours,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
aviv ron
Top achievements
Rank 1
answered on 19 Apr 2010, 01:14 PM
the blog post does not have any reference to IsActive in code
0
Rossen Hristov
Telerik team
answered on 19 Apr 2010, 02:26 PM
Hi aviv ron,

I am sorry. I meant this blog post. My mistake.

Anyway, the sample project that is attached in the "Pre-Filtering" blog post does work and does show that filters are set. You can even see this in the embedded Silverlight application which is inside the blog post.

Maybe you have changed something and that is why it is not working?

I am attaching a sample project that does work. You can take a look at it. What are you doing different to break it?

Regards,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
aviv ron
Top achievements
Rank 1
answered on 21 Apr 2010, 03:23 PM
Hi Ross.

in the demo the filter is being added in the constructor.
what i do differently is get my data and according to the data add the filter, so that is being done after the grid has already been rendered to the UI... i tried the same on the demo (took the code out of the constructor to a delayed method) and then it behaves the same as my grid (icon doesn't reflect filter).

i tried to call rebind and update layout but that didn't do the job.

here is an example of what i am doing:
        public SelectRoomsPopUp() 
        { 
            InitializeComponent(); 
            CaratServiceClient service = new CaratServiceClient(); 
            service.GetActiveRoomsCompleted += new EventHandler<GetActiveRoomsCompletedEventArgs>( 
                (s, e) =>  
                { 
                    if (e.Error == null
                    { 
 
                        var room = e.Result.FirstOrDefault(rm => rm.SiteCode.Equals(App.Scope.CurrentUser.Employee.SiteCode)); 
                        if (room != null
                        { 
                            ColumnFilterDescriptor numberColumnFilter = 
                            new ColumnFilterDescriptor((IDataFieldDescriptor)this.gridRooms.Columns[0]); 
                            numberColumnFilter.DistinctFilter.DistinctValues.Add( room.SiteName); 
                            this.gridRooms.FilterDescriptors.Add(numberColumnFilter); 
                        } 
 
                        gridRooms.ItemsSource = e.Result.OrderBy(order => order.FullName).ToList(); 
 
                    } 
                    service.CloseAsync(); 
                    busyIndicator.IsBusy = false
                } 
                ); 
            service.GetActiveRoomsAsync(); 
 
               
        } 

0
Rossen Hristov
Telerik team
answered on 23 Apr 2010, 11:38 AM
Hi aviv ron,

Now we see your scenario. We have identified a bug and will try to fix it as soon as possible.

You can follow the PITS Issue by its ID: 1903

Greetings,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
aviv ron
Top achievements
Rank 1
Answers by
Vlad
Telerik team
aviv ron
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or