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

Grouping Err in RadScheduler

3 Answers 94 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
johnson lim
Top achievements
Rank 1
johnson lim asked on 22 Apr 2010, 05:48 AM
Hi, i face grouping error in groping resources in radscheduler.
 I had follow all the steps in the demo but  when it come to groupby it fail.
My error is as below :
Line :3396
Char:26
Err:'this.cells0.offsetHeight is null or not an object'
code:0

Does anyone has idea on this ??


My coding is as below :
<telerik:RadScheduler ID="RadScheduler1" runat="server" GroupBy="LineNum"  
        DataKeyField="ID" DataSubjectField="Desc" 
                DataStartField="StartDate" DataEndField="EndDate" 
                DataRecurrenceField="ID" SelectedDate="2010-04-22" 
                DataRecurrenceParentKeyField="ID" RowHeaderWidth="52px" 
                 SelectedView =TimelineView  
                > 
                <AdvancedForm Modal="true" /> 
    
        </telerik:RadScheduler> 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
 
     
 
 
        Try 
            If Not Page.IsPostBack = True Then 
               CreateTable() 
               AddRowTomdsResult() 
 
                RadScheduler1.DataSource = mdsResult 
                RadScheduler1.DataBind() 
            
 
 
            End If 
        Catch ex As Exception 
            Throw ex 
        End Try 
       
       Private Sub AddRowTomdsResult() 
 
        Dim dr As Data.DataRow 
 
        Try 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 1 
            dr("LineNum") = "1.1" 
            dr("ShiftNum") = "Morning" 
            dr("Desc") = "X1" 
            dr("StartDate") = "3/3/2010" 
            dr("EndDate") = "3/3/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 2 
            dr("LineNum") = "1.1" 
            dr("ShiftNum") = "Morning" 
            dr("Desc") = "X1" 
            dr("StartDate") = "3/3/2010" 
            dr("EndDate") = "3/3/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 3 
            dr("LineNum") = "1.1" 
            dr("ShiftNum") = "Morning" 
            dr("Desc") = "X1" 
            dr("StartDate") = "3/3/2010" 
            dr("EndDate") = "3/3/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 4 
            dr("LineNum") = "1.2" 
            dr("ShiftNum") = "Grave" 
            dr("Desc") = "X1" 
            dr("StartDate") = "4/22/2010" 
            dr("EndDate") = "4/22/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 5 
            dr("LineNum") = "1.2" 
            dr("ShiftNum") = "Grave" 
            dr("Desc") = "X1" 
            dr("StartDate") = "4/22/2010" 
            dr("EndDate") = "4/22/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 6 
            dr("LineNum") = "1.2" 
            dr("ShiftNum") = "Grave" 
            dr("Desc") = "X1" 
            dr("StartDate") = "4/22/2010" 
            dr("EndDate") = "4/22/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
        Catch ex As Exception 
            Throw ex 
        End Try 
 
    End Sub 
 
 
    Private Sub CreateTable() 
        Dim table As New DataTable 
        Dim column As DataColumn 
 
        Try 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.Int32") 
            column.ColumnName = "ID" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.String") 
            column.ColumnName = "LineNum" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.String") 
            column.ColumnName = "ShiftNum" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.String") 
            column.ColumnName = "Desc" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.DateTime") 
            column.ColumnName = "StartDate" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.DateTime") 
            column.ColumnName = "EndDate" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
            mdsResult.Tables.Add(table) 
 
        Catch ex As Exception 
            Throw ex 
        End Try 
 
    End Sub 
 
 
 
 
    End Sub

3 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 22 Apr 2010, 09:17 AM
Hi Johnson,

It seems like you haven't defined the LineNum resource type. Please, refer to this help topic for information on how to define resources:

http://www.telerik.com/help/aspnet-ajax/schedule_designcustomresourcesandattributes.html

Look at this example as well:

http://demos.telerik.com/aspnet-ajax/scheduler/examples/resources/defaultcs.aspx

I hope this helps.

Kind regards,
Tsvetomir Tsonev
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
johnson lim
Top achievements
Rank 1
answered on 22 Apr 2010, 09:52 AM
Hi, thanks for your kind reply.

I have ammend it as below. Now it is able to do grouping but after grouping all the data lost.
I think that i am quite close to the point already, just 1 step away.

My code behind is as below:
<ajax:RadScheduler runat="server" ID="RadScheduler1" DayEndTime="19:00:00" TimeZoneOffset="03:00:00" 
              DataKeyField="ID" DataSubjectField="Desc" 
                DataStartField="StartDate" DataEndField="EndDate" SelectedView="TimelineView" 
                 OverflowBehavior="Expand" ShowViewTabs="False"  
                > 
                <AdvancedForm Modal="True" /> 
                 
         <TimeSlotContextMenuSettings EnableDefault="True" /> 
         <AppointmentContextMenuSettings EnableDefault="True" /> 
       <ResourceTypes> 
                            
       </ResourceTypes> 
            </ajax:RadScheduler> 

My coding is as below:
Protected Sub Page_PreLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreLoad 
        CreateTable() 
        AddRowTomdsResult() 
 
        Dim cResourceType As New Telerik.Web.UI.ResourceType 
 
        cResourceType.DataSource = getLineName() 
 
        cResourceType.Name = "Line" 
        cResourceType.KeyField = "LineName" 
        cResourceType.TextField = "LineName" 
 
        cResourceType.ForeignKeyField = "LineNum" 
 
        RadScheduler1.ResourceTypes.Add(cResourceType) 
 
 
        RadScheduler1.GroupBy = "Line,Date" 
 
        RadScheduler1.GroupingDirection = GroupingDirection.Vertical 
 
        RadScheduler1.SelectedView = SchedulerViewType.TimelineView 
 
        RadScheduler1.DataSource = mdsResult 
        RadScheduler1.DataBind() 
 
 
    End Sub 
 
    Private Function getLineName() As DataSet 
 
        Dim dsLineName As New DataSet 
 
        Dim dr As Data.DataRow 
 
        dsLineName = CreateLineTable() 
 
        dr = dsLineName.Tables(0).NewRow 
 
        dr("LineNum") = "1.2" 
        dr("LineName") = "LINE 1.2" 
 
        dsLineName.Tables(0).Rows.Add(dr) 
 
 
 
        dr = dsLineName.Tables(0).NewRow 
 
        dr("LineNum") = "1.3" 
        dr("LineName") = "Line 1.3" 
 
        dsLineName.Tables(0).Rows.Add(dr) 
 
        Return dsLineName 
 
    End Function 
 
    Private Function CreateLineTable() As DataSet 
        Dim table As New DataTable 
        Dim column As DataColumn 
 
        Dim ds As New DataSet 
 
        column = New DataColumn() 
        column.DataType = System.Type.GetType("System.String") 
        column.ColumnName = "LineNum" 
        column.ReadOnly = False 
        column.Unique = False 
        table.Columns.Add(column) 
 
 
        column = New DataColumn() 
        column.DataType = System.Type.GetType("System.String") 
        column.ColumnName = "LineName" 
        column.ReadOnly = False 
        column.Unique = False 
        table.Columns.Add(column) 
 
        ds.Tables.Add(table) 
 
        Return ds 
 
    End Function 
 
 
    Private Sub AddRowTomdsResult() 
 
        Dim dr As Data.DataRow 
 
        Try 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 4 
            dr("LineNum") = "1.2" 
            dr("Desc") = "X1" 
            dr("StartDate") = "4/22/2010" 
            dr("EndDate") = "4/22/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 5 
            dr("LineNum") = "1.2" 
            dr("Desc") = "X1" 
            dr("StartDate") = "4/22/2010" 
            dr("EndDate") = "4/22/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 6 
            dr("LineNum") = "1.2" 
            dr("Desc") = "X1" 
            dr("StartDate") = "4/22/2010" 
            dr("EndDate") = "4/22/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 6 
            dr("LineNum") = "1.3" 
            dr("Desc") = "Y1" 
            dr("StartDate") = "4/23/2010" 
            dr("EndDate") = "4/23/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
        Catch ex As Exception 
            Throw ex 
        End Try 
 
    End Sub 
 
 
    Private Sub CreateTable() 
        Dim table As New DataTable 
        Dim column As DataColumn 
 
        Try 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.Int32") 
            column.ColumnName = "ID" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.String") 
            column.ColumnName = "LineNum" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.String") 
            column.ColumnName = "Desc" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.DateTime") 
            column.ColumnName = "StartDate" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.DateTime") 
            column.ColumnName = "EndDate" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
            mdsResult.Tables.Add(table) 
 
        Catch ex As Exception 
            Throw ex 
        End Try 
 
    End Sub 
Can you please advice me which part i miss out ??








0
johnson lim
Top achievements
Rank 1
answered on 22 Apr 2010, 12:03 PM
hi, i have get it solved  by doing this  cResourceType.KeyField = "LineNum"
Tags
Scheduler
Asked by
johnson lim
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
johnson lim
Top achievements
Rank 1
Share this question
or