How to deselect a date in monthview

7 posts, 0 answers
  1. rincy
    rincy avatar
    14 posts
    Member since:
    Nov 2014

    Posted 19 Mar 2015 Link to this post

    Hi,

    In calendar month mode I want to deselect a date by taping on the selected date. 


    Thanks & Regards,
    Rose.

  2. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 20 Mar 2015 Link to this post

    Hello Rincy,

    Thank you for writing.

    By default a selected cell is being deselected when taped. The only exception would be the range selection mode, where you cannot disable the first selected date.

    What type of selection are you using? Single, multiple or range?

    Regards,
    Antony Jekov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. rincy
    rincy avatar
    14 posts
    Member since:
    Nov 2014

    Posted 20 Mar 2015 in reply to Antony Jekov Link to this post

    I want single selection only.But couldnt find how to do single selection so am usingion so am using following code to select

     private void GoToDate(Calendar cal) {        
            List<Long> dates = new ArrayList<Long>();
            dates.add(cal.getTimeInMillis());
            calendarView.setSelectedDates(dates);        
            calendarView.setDisplayDate(cal.getTimeInMillis());
        }
  5. rincy
    rincy avatar
    14 posts
    Member since:
    Nov 2014

    Posted 20 Mar 2015 Link to this post

    I got problem.

    When am using CalendarSelectionMode single I couldn't deselect it.
    calendarView.setSelectionMode(CalendarSelectionMode.Single);  when i remove this line i can deselect by tapping the selected . date,but calendar will allow multiple selection.Please gives me a suggestion to resolve this.

    I want single selection and when tapping on selected date it should deselect.
  6. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 20 Mar 2015 Link to this post

    Hello Rincy,

    As mentioned in the private ticket you sent me, this would be a possible solution:
    @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            final RadCalendarView calendarView = new RadCalendarView(this);
     
            calendarView.setSelectionMode(CalendarSelectionMode.Single);
            calendarView.setGestureManager(new CustomGestureManager(calendarView));
     
            setContentView(calendarView);
        }
     
        class CustomGestureManager extends CalendarGestureManager {
     
            public CustomGestureManager(RadCalendarView owner) {
                super(owner);
            }
     
            @Override
            protected void handleTapGesture(CalendarDayCell calendarCell) {
                if (calendarCell.isSelected()) {
                    owner.setSelectedDates(null);
                } else {
                    super.handleTapGesture(calendarCell);
                }
            }
        }

    I will check with our designer and see if I can enable this by default.

    Thank you for your time and all best!

    Regards,
    Antony Jekov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. dlhts_swam
    dlhts_swam avatar
    1 posts
    Member since:
    Jul 2012

    Posted 23 Mar 2015 in reply to Antony Jekov Link to this post

    Hi,

    Hi Antony,

    Thanks for your reply.
    I have tried this code before by passing null to 'setSelectedDates',But its throwing an exception I'ndexOutOfBoundsException:Invalid index 0,size 0'.I think 'setSelectedDates' wont handle null.Could you please check it out?

    Thanks & Regards,
    Rincy Rose
  8. Antony Jekov
    Admin
    Antony Jekov avatar
    88 posts

    Posted 24 Mar 2015 Link to this post

    Hello Rincy,

    Since you sent a private ticket, I am going to proceed and close this one. Please refer to the conversation there.

    Regards,
    Antony Jekov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top
DevCraft banner