Hi there,
How can I initiate a calendar to show a certain month on one web page? e.g. I need to set the calendar to show June 2017 when the calendar shows up.
Thanks!
Hi there,
How can I initiate a calendar to show a certain month on one web page? e.g. I need to set the calendar to show June 2017 when the calendar shows up.
Thanks!
Use demo project Order table field OrderDate as an example, you can add below code in the startup script of add page to change the initial date of the calendar.
$(function(){
var btn = $("#el_Orders_OrderDate").find("button")[0]; // Get the calendar button object.
var fn = btn.onclick; // save the click event in variable fn.
btn.onclick = null; // unsubscribe the origial onclick event to prevent call the origial function twice.
$("#el_Orders_OrderDate").find("button").on("click", function(e, args){ //subscribe the onclick event.
fn(); //call the origial function and the calendar will saved into "window.calendar".
window.calendar.setDate(new Date("2016/01/01")); // get the calendar object and use setDate function to change the initial date.
});
});
You may need to check is there any value in the input before you change the date of the calendar.
Read the document of jsCalendar for more information.