How to know direction in Wijmo 3 wijcalendar beforeSlide

Posted by: stefan.brenner.a on 15 November 2017, 9:24 pm EST

    • Post Options:
    • Link

    Posted 15 November 2017, 9:24 pm EST

    Hi,

    I’m using the Wijmo 3 wijcalendar to display multiple months and allow a selection across months. Now I have the issue that if a user clicks the previous/next button the control will move to the next set of months and not just one month ahead. For example if I display 3 months it will always move 3 months. Now if a user wants to select dates across two months there will be combinations he cannot access. So I wanted to change this so the movement is always only 1 month but I couldn’t find anything fitting. navButtons quick doesn’t seem to work with multiple months and there is no step for the devault navButtons as far as I can see.

    So I’m now trying to solve this by catching the beforeSlide event, cancel it and handle the steps myself by setting the displayDate. This works but I don’t know how to check if the user clicked the previous or next button, so I’m always just moving ahead and never back. Could you please tell me how to check which direction the slide is supposed to go? Do you maybe also know of a better option to change the slide behaviour to 1 month?

    Thanks and best regards

  • Posted 19 November 2017, 11:14 pm EST

    Hi Stefan,

    We are investigating on this.

    ~Manish

  • Posted 21 November 2017, 12:05 am EST

    Hi Stefan,

    You can get the pressed button by handling mousedown event and using event target. Please refer to the following code snippet:

    $(document).ready(function (){  
               $("#theCalendar").wijcalendar({
                   monthRows:1,
                   monthCols:3,
                   beforeSlide:function(e){
                       e.preventDefault();
                       console.log($("#theCalendar").wijcalendar("getDisplayDate").getMonth());
                   }
               });
               $("#theCalendar").mousedown(function(e){                
                   var _a=e.target.id;
                   var _spn= e.target.tagName=="SPAN" ? e.target.innerText.toLowerCase() : null;
                   var _btn=_a || _spn;
                   console.log(_btn);
               });
           }); 
    

    ~Manish

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels