You must Sign In to post a response.
  • Category: JQuery

    clicking the Calendar arrows next/previous buttons and load the data once stop click

    I have a calendar image with previous and next button icon. If I click on the calendar image, calendar popup will open. After selecting the date then loading relevant gridload function. If I click the previous/next icon button, the gridload function execute without open calendar popup. I used the following code for that,

    var dateText = $(thisElement).parent().find('input.datepicker').datepicker('getDate');
    if ($(thisElement).hasClass('left-arrow')) {
    dateText.setDate(dateText.getDate() - 1);
    else if ($(thisElement).hasClass('right-arrow')) {
    dateText.setDate(dateText.getDate() + 1);
    $(thisElement).parent().find('input.datepicker').datepicker('setDate', dateText);

    My new requirement is, If I click previous/next button click it fast, trying to go back 2 or 3 days, the system won't try to load the grid data for each of those dates, and will just load it once they stop clicking.

    Please help for solving this issue.
  • #761137
    Hai Shajahan,
    Actually in your code:
    is getting called each time when you go back and forth, becasue it will always get the value of the date picker using the below code snippet:
    $(thisElement).parent().find('input.datepicker').datepicker('setDate', dateText);
    So to fix the issue when you are clicking back and forth, you need to disable this event and it should only work when you are changing the value of the date picker. To do so, you can use .disableSelection()
    For more details, you can go to the below link:

    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

Sign In to post your comments