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

Appointment Filter doesn't work the second time around

6 Answers 103 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Maaz
Top achievements
Rank 1
Maaz asked on 30 Apr 2013, 05:27 AM
I'm facing this weird issue of the appoint filter not working the second time around.

My Application has calendars for different users.

When I first load the scheudle view (calendar) and try to filter it all works well. But then when I try to change the calendar for another user and then apply filter on it, nothing seems to happen. 

When I debugged, I realised that the predicate does hit all the time the filter is supposed to be called. But the second time around the predicate doesn't call the filter appointment method at all. I'm puzzled as to why this happens and need you to help me. 

As a background, I've bound the predicate (FilteredAppointments) to the appointment filter property in the xaml and the predicate then calls the filter appointment method (which returns a bool for each appointment). Also, all these are in separate classes, i.e. the predicate and the filterAppointments method.

Please help, need to resolve this ASAP.

6 Answers, 1 is accepted

Sort by
0
Maaz
Top achievements
Rank 1
answered on 02 May 2013, 07:03 AM
Any update on this? It's kind of really urgent for me to sort this out.
0
Miroslav Nedyalkov
Telerik team
answered on 02 May 2013, 10:00 AM
Hi Maaz,

In this example you can find how to dynamically change the filter. The example is for the RadScheduleView control for Silverlight, but the same code works fine for WPF as well.

Hope this helps.

Kind regards,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Maaz
Top achievements
Rank 1
answered on 03 May 2013, 12:48 PM
I've tried exactly the same thing, it filters the first time ... but it doesn't the second time around. The predicate doesn't call the filter method at all (the second time around). What could be the reason?

And could you also help me with the filter counts?
0
Miroslav Nedyalkov
Telerik team
answered on 06 May 2013, 08:24 AM
Hi Maaz,

Most probably the source of the problem is that you are not generating a new instance of the predicate, but you always return the same method. To make sure your predicate is correctly changed you need to change its value like this:
Filter = new Func<IAppointment, bool>(a => this.MyFilter(a))
instead of
Filter = this.MyFilter;

Hope this helps.

Regards,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Maaz
Top achievements
Rank 1
answered on 06 May 2013, 12:19 PM
I tried this too, but again the same problem.

When I first filter ... everything goes fine, I can filter as many times as I want to.

But when I change the user to load another calendar, there's no filtering. The predicate is called, but the second time around the predicate fails to call it's method. I still don't know why. And now when I go back to the first user again, it still doesn't filter.
0
Miroslav Nedyalkov
Telerik team
answered on 09 May 2013, 08:27 AM
Hi Maaz,

I tried your scenario, but the filtering works as expected. Please take a look at the attached project and let me know if I'm missing something.

Kind regards,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ScheduleView
Asked by
Maaz
Top achievements
Rank 1
Answers by
Maaz
Top achievements
Rank 1
Miroslav Nedyalkov
Telerik team
Share this question
or