Event Overlapping

2 posts, 0 answers
  1. vijay
    vijay avatar
    23 posts
    Member since:
    May 2015

    Posted 17 Oct 2015 Link to this post

    Hello Telerik,

     I want to display to two event in a date but both event are overlapped. only one visible at a time. how to set event position in calendar cell.

    please check attached image and also check below code.

    please help me out of this situation.

    Date date = new Date();
    ArrayList<Event> firstHalf = new ArrayList<Event>();
    ArrayList<Event> secondHalf = new ArrayList<Event>();

    try {
    DateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy");
    for (int i = 0; i < ​attendanceDetails.size(); i++) {
    date = formatter.parse(​attendanceDetails.get(i).get​attendanceDetailsDate());
    long startDate = date.getTime();
    date.setTime(startDate - ​1);
    long endDate = date.getTime();
    Event event = new Event(​attendanceDetails.get(i).getFirstHalfAttendance(), endDate, startDate);
    event.setEventColor(Color.parseColor("#60ff2010"));
    firstHalf.add(event);
    }
    }catch (Exception ex){
    ex.printStackTrace();
    }

    try {
    DateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy");
    for (int i = 0; i < ​attendanceDetails.size(); i++) {
    date = formatter.parse(​attendanceDetails.get(i).get​attendanceDetailsDate());
    long startDate = date.getTime();
    date.setTime(startDate -1);
    long endDate = date.getTime();
    Event event = new Event(​attendanceDetails.get(i).getSecHalfAttendance(), endDate, startDate);
    event.setEventColor(Color.DKGRAY);
    secondHalf.add(event);
    }
    }catch (Exception ex){
    ex.printStackTrace();
    }
    calendarView.getEventAdapter().setEvents(firstHalf);
    calendarView.getEventAdapter().setEvents(secondHalf);​

  2. Todor
    Admin
    Todor avatar
    778 posts

    Posted 21 Oct 2015 Link to this post

    Hello Vijay,

    Thank you for your question.

    You can use a custom event render to render events as per your requirements. Please have a look at this thread which contains a sample to get you started.

    Regards,
    Todor
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top