How to programmatically navigate

Hi support team,

i'm working on C#, .NET, Angular 4 project and i'm using ejDatePicker in inline mode (always open calendar). I have question related with calendar navigation. I have some custom buttons and i want when i click button to change calendar on some specific year , month and day. 

For example currently i'm on April month year 2018 and some day, when i click my custom button i want to calendar change and navigate on Jun 20. year 2019.

Is this possible? Is there any built in method that i can use for this?

Best regards,
Goran. 

3 Replies

SP Sureshkumar P Syncfusion Team April 3, 2018 04:55 PM UTC

Hi Goran, 
 
Thank you for contacting Syncfusion support, 
 
Yes, we have change the view of the calendar to specific view. we have achieved your requirement by setting the value through instance variable. Please refer the below code-block 
[sample.html] 
       
      <div align="center"> 
    <div id="datepick" ej-datepicker [(displayInline)]="inline" #datepick [(ngModel)]="value"></div> 
    </div> 
    <div align="center"> 
        <br><br> 
    <button id="btnOpen" type="button" ej-button (click)="onClick($event)" text="click to navigate the value" ></button> 
    </div> 
 
[sample.ts] 
 
value: object; 
  inline: boolean; 
  @ViewChild('datepick') datepick: any; // instance variable of the rendered datepicker control 
  constructor() { 
    this.value = new Date(); 
    this.inline = true; 
 
  //Button click event handler to open the ejDialog 
  onClick(event: any) { 
  // setting the value through setmodel by using instance variable  
    this.datepick.widget.option('value',new Date("20 Jan 2019")); 
 
In the above code-block we have change the view of the calendar today date into Jan 20,2019. 
 
Also, for your convenience we have attached the sample based on your requirement. Please find the sample here: http://www.syncfusion.com/downloads/support/forum/136793/ze/DatePicker-1168107617  
 
Regards, 
Sureshkumar P 



GO Goran April 5, 2018 09:09 AM UTC

Hi Sureshkumar,

your solution works perfectly fine! Thanks for quick response!

Best regards,
Goran.


SP Sureshkumar P Syncfusion Team April 6, 2018 03:47 AM UTC

Hi Goran, 
  
Thanks for your update. 
  
We are glad to hear that your problem is resolved. Please get back to us if you need further assistance. 
  
Regards, 
Sureshkumar P

Loader.
Up arrow icon