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

[Solved] items correctly grouped but not sorted

6 Answers 122 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Rudolf Kajan
Top achievements
Rank 1
Rudolf Kajan asked on 27 Jul 2009, 01:46 PM
Hello,

I have a bit problem with scheduler - I would like to display grouped items sorted by different property than the primary key, which I think is the default way that scheduler sorts by.

Now I have:
In C#:
var planesQuery = from plane in entities.PlaneSet orderby plane.PlaneCategory select plane; 
In scheduler: 
GroupBy="Plane"

This C# query selects planes correctly ordered, but scheduler does not show them in order defined by planesQuery, it reorders planes, they are sorted by primary key. I need something like OrderBy="Plane. PlaneCategory"

How can I solve this ? Thanks in advance.

6 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 28 Jul 2009, 02:00 PM
Hi Rudolf,

I tried the following with the EntityDataSource demo and it worked fine:

<asp:EntityDataSource runat="server" ID="EntityDataSource3" ConnectionString="name=TelerikEntities" 
            DefaultContainerName="TelerikEntities" OrderBy="it.[UserName]"   EntitySetName="Users">  
        </asp:EntityDataSource> 

I have also changed the values in the User data table like this:

ID  UserName
1    Bob
2    Alex
3    Charlie

Radscheduler showed the resources alphabetically

Alex
Bob
Charlie




Kind regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rudolf Kajan
Top achievements
Rank 1
answered on 29 Jul 2009, 08:12 AM
I tried your orderby statement, but unfortunately it is not working for me. It looks like RadScheduler completly ignores it.  I set orderby to nonexisting property OrderBy="Plane.[abcdefgh]" and no error was reported, nothing happened, that's why I think scheduler ignores it. Could it be ignored because "groupby" is used ? 
0
Peter
Telerik team
answered on 29 Jul 2009, 10:04 AM
Hi Rudolf,

Using GroupBy for RadScheduler will not affect what is returned by the entityDataSource. You should use "it". This is what I found out: http://naspinski.net/post/Using-orderby-with-an-EntityDataSource.aspx
So in your case you should try: OrderBy="it.[PlaneCategory]" or  OrderBy="it.[Plane]" , depending on the column name that you want to sort by.



Regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rudolf Kajan
Top achievements
Rank 1
answered on 29 Jul 2009, 10:19 AM
Hello, thanks for responses, unfortunately change to "it" did not help. It looks like whole orderby statement is ignored, whatever I write to it, whether column name is correct or not, it is ignored. Here is my scheduler, can you please have a look and tell me if there is anything wrong, or missing ? Thank you.

<telerik:RadScheduler 
                    ID="scheduler" 
                    runat="server" 
                    Width="995" 
                    DataStartField="BorrowX"
                    DataEndField="ReturnX" 
                    DataKeyField="No" 
                    DataSubjectField="No" 
                    ShowHeader="true"
                    ShowFooter="false" 
                    ShowAllDayRow="true" 
                    ShowFullTime="true" 
                    SelectedView="TimelineView"
                    GroupBy="Plane"
                    OrderBy="it.[PlaneCategory]"
                    GroupingDirection="Vertical" 
                    AllowDelete="false" AllowEdit="false"
                    AllowInsert="false" 
                    RowHeight="30" 
                    Height="4000" 
                    OnDataBound="scheduler_DataBound"
                    OnAppointmentDataBound="scheduler_AppointmentDataBound"                                   OnAppointmentCreated="scheduler_AppointmentCreated"
                    RowHeaderWidth="170" Skin="Fair" EnableEmbeddedSkins="false" ShowNavigationPane="false"
                    ShowViewTabs="false" ReadOnly="true">
                    <TimelineView TimeLabelSpan="2" ShowDateHeaders="true" />
                    
                    <ResourceTypes>
                        <telerik:ResourceType KeyField="No" Name="Plane" TextField="ResourceHeaderHtml" ForeignKeyField="Plane.No"
                            DataSourceID="Planes" />
                    </ResourceTypes>
                    
                    <ResourceHeaderTemplate>
                        <%# ToHtmlText((string)Eval("Text"))%>
                    </ResourceHeaderTemplate>
                    
                </telerik:RadScheduler>
0
Peter
Telerik team
answered on 29 Jul 2009, 10:32 AM

OrderBy="it.[PlaneCategory]"  should be set for the EntityDataSource, not for RadScheduler.

Best wishes,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rudolf Kajan
Top achievements
Rank 1
answered on 03 Aug 2009, 11:24 AM
OK, now it works, thank you
Tags
Scheduler
Asked by
Rudolf Kajan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Rudolf Kajan
Top achievements
Rank 1
Share this question
or