Oder of Entry in Scheduler

15 posts, 0 answers
  1. Praveen
    Praveen avatar
    13 posts
    Member since:
    Mar 2009

    Posted 06 Apr 2010 Link to this post

    I am using a TimelineView Scheduler and order in which displays items/appointment is pretty random. I have field in the Database called priority and based on the priority, the order of the items/appointment should be displayed.

    Let says I have 3 appointments scheduled on the same day for example APP1,APP2 and APP3 and their priorities are 3,2 and 1. I want the scheduler to be displayed as APP3, APP2 and APP1 but instead it displays APP1, APP2 and APP3.

    Any ideas how to crack this.

    Praveen

  2. Praveen
    Praveen avatar
    13 posts
    Member since:
    Mar 2009

    Posted 06 Apr 2010 Link to this post

    Can some one throw some ideas?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Praveen
    Praveen avatar
    13 posts
    Member since:
    Mar 2009

    Posted 06 Apr 2010 Link to this post

    How do we sort items/appointment inside TimeLine View using a custom field called "X" in the database.
  5. Praveen
    Praveen avatar
    13 posts
    Member since:
    Mar 2009

    Posted 07 Apr 2010 Link to this post

    I have been waiting for almost couple of days.  Can some one atleast respond some thing. This is very very urgent.
  6. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 08 Apr 2010 Link to this post

    Hi Praveen,

    Please, use the AppointmentComparer property of RadScheduler as shown below:

    class CustomAppointmentComparer : IComparer<Appointment>
        {
            public int Compare(Appointment first, Appointment second)
            {
                if (first == null || second == null)
                {
                    throw new InvalidOperationException("Can't compare null object(s).");
                }
      
                if (first.Start < second.Start)
                {
                    return -1;
                }
      
                if (first.Start > second.Start)
                {
                    return 1;
                }
      
                if (first.End > second.End)
                {
                    return -1;
                }
                if (first.Attributes["Priority"] != null & second.Attributes["Priority"] != null)
                {
                    return String.Compare(first.Attributes["Priority"].ToString(), second.Attributes["Priority"].ToString());
                }
                return 0;
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            XmlSchedulerProvider provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/AppointmentsA.xml"), true);
            RadScheduler1.Provider = provider;
        }   
        protected void Page_Load(object sender, EventArgs e)
        {
            RadScheduler1.AppointmentComparer = new CustomAppointmentComparer(); 
        }

    Attached is a demo page.

    Greetings,
    Peter
    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.
  7. Praveen
    Praveen avatar
    13 posts
    Member since:
    Mar 2009

    Posted 08 Apr 2010 Link to this post

    Looks like this will work when you bind XML using the <Attribute Key="Priority" />. What if I am not using XML and the Priority field comes from the database. In that case do you think CustomAttributeNames="Priority" EnableCustomAttributeEditing="true" setting will work.
  8. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 08 Apr 2010 Link to this post

    Hello Praveen,

    Yes, attributes are available when binding to a data source as well. You only need to include them in your Insert/Update/Select queries.

    I hope this helps.

    All the best,
    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.
  9. Praveen
    Praveen avatar
    13 posts
    Member since:
    Mar 2009

    Posted 08 Apr 2010 Link to this post

    Thanks a lot. You guys rock. It works great.
  10. Sam Smith
    Sam Smith avatar
    1 posts
    Member since:
    Aug 2004

    Posted 25 Nov 2011 Link to this post

    Every post I find about appointment order comes back here, but I'm not sure how I would use this to sort by start date and then description (as sometimes I have two appointments in the same time period and I'd like to sort left to right). Can you please provide an example?

    thanks

    Sam
  11. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 28 Nov 2011 Link to this post

    Hi Sam Smith,

    The approach is still the same. Instead of a custom attribute, you should use the Description property:

    return String.Compare(first.Description, second.Description);

    Please, let me know if I have misunderstood your question.

    All the best,
    Peter
    the Telerik team
    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 their blog feed now
  12. Allen
    Allen avatar
    111 posts
    Member since:
    Apr 2012

    Posted 18 May 2012 Link to this post

    Do you have VB code for this?
  13. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 19 May 2012 Link to this post

    Hello Allen,

    Unfortunately, we don't have a VB version of the code, but you can use Telerik's code converter - http://converter.telerik.com/.


    All the best,
    Peter
    the Telerik team
    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 their blog feed now.
  14. Brian
    Brian avatar
    28 posts
    Member since:
    Dec 2008

    Posted 29 Aug 2012 Link to this post

    Wouldn't it be easier to retrieve the data from your datasource and add an 'order by' clause?
  15. jajati
    jajati avatar
    1 posts
    Member since:
    Jun 2015

    Posted 10 Jun 2015 in reply to Peter Link to this post

    Hi Admin,

    Sorting is working for me when I have 1 field(Country). But when I have 2 fields county and State, I want to sort By country field first and then sort by State field. 

     

    Could you please help? It is bit urgent.

  16. jajati
    jajati avatar
    1 posts
    Member since:
    Jun 2015

    Posted 10 Jun 2015 in reply to Peter Link to this post

    Hi Admin

    Sorting is working fine for me when I am doing the sort by 1 field (by Country). But could you please help how to sort if I have 2 fields Country, State ? First 1 want to sort by Country and then by state. Also I should be able to order by Desc or Asc

     It is bit urgent. Could you please help?

     

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017