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

radscheduler resource grouping with a provider not showing appointments

1 Answer 122 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Danny
Top achievements
Rank 1
Danny asked on 14 Jun 2013, 02:07 PM
Hi,
I am trying to group my RadScheduler by a resource (Staff). The scheduler has appointments on it and the appointments have resources added by the provider. However, as soon as I add GroupBy="Staff" to the markup, I get no appointments displaying and the scheduler only shows the "all day" row. Interrestingly, a breakpoint in the AppointmentsPopulating method shows the appointments (with the correct resources) but the AppointmentCreated method never fires.

Below is how I've set up the provider to add the Staff resource.
In my provider I have a dictionary defined this way "Private dictResources As IDictionary(Of ResourceTypeIEnumerable(Of Resource))" which the GetAppointments method populates like this:
Select Case strType.ToUpper()
    Case "STAFF"
        typType = New ResourceType(strType, True)
        lstResource = GetStaffResources(myInfo.intSite_pKey)
End Select
If Not lstResource Is Nothing Then GetResources.Add(typType, lstResource)

The GetStaffResources method contains the following:
For Each dr As DataRow In dt.Rows
    Dim pKey As Integer = dr.Item(dt.Columns.IndexOf("pKey"))
    Dim Contact_pKey As Integer = dr.Item(dt.Columns.IndexOf("Contact_pKey"))
    Dim Name As String = dr.Item(dt.Columns.IndexOf("Fullname"))
 
    Dim item As New clsSchedResStaff()
 
    item.pKey = pKey
    item.Contact_pKey = Contact_pKey
    item.Name = Name
 
    Dim res As New Resource
    res.Key = item.pKey
    res.Text = item.Name
    res.DataItem = item
    res.Type = "Staff"
 
    GetStaffResources.Add(res)
Next

Finally, LoadResource (which is called from GetAppointments just before the Appointment is added to the list of appointments) looks like this:
Private Sub LoadResources(apt As Appointment)
    Dim arrStaffPKeys As String() = apt.Attributes("StaffPKeys").Split(";")
    For Each pairResource As KeyValuePair(Of ResourceType, IEnumerable(Of Resource)) In dictResources
        Dim lstResources As List(Of Resource) = pairResource.Value.ToList()
        Dim strType As String = pairResource.Key.Name.ToUpper()
 
        For Each theResource As Resource In lstResources
            Select Case strType
                Case "STAFF"
                    Dim item As clsSchedResStaff = DirectCast(theResource.DataItem, clsSchedResStaff)
                    If arrStaffPKeys.Contains(item.Contact_pKey) Then
                        apt.Resources.Add(theResource)
                    End If
            End Select
        Next
    Next
End Sub

As I said, all this works fine until I try to group by "Staff" and then no appointments get to the page. In fact, no TimeSlots get to the page either except the AllDay row. Any help you can provide regarding what could be the cause of this symptom would be appreciated.

Thanks,
Danny

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 19 Jun 2013, 02:41 PM
Hello,

Please find attached our provider used to populate RadScheduler control in the following online demo. As you can notice the grouping functionality works as expected on the demo. I would suggest following the pattern in our provider to avoid any unusual behavior. 

Regards,
Boyan Dimitrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Scheduler
Asked by
Danny
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or