jQuery UI Widgets Forums Editors Calendar Clear button for calendar

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 8 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Clear button for calendar #87972

    JellyRaptor
    Participant

    I am trying to make a simple clear button for a jqxCalendar (having selectionMode ‘range’) in an angular spa using jqwidgets 4.2.1. I want the button to be disabled if there is nothing selected (and therefore nothing to clear). Here is my markup.

    <jqx-calendar ng-model=”vm.dates” jqx-instance=”vm.calendar” jqx-settings=”{width:200, selectionMode: ‘range’}”><jqx-calendar>
    <button ng-click=”vm.calendar.clear()” ng-disabled=”!vm.calendar.selectedDate”>Clear</button>

    vm.calendar.selectedDate is undefined at first, so the button is disabled as expected. The variable vm.calendar.selectedDate updates just fine when the user executes a single click on a date. I would thus expect angular to have triggered a re-evaluation of the expression in ng-disabled and disable the button. It doesn’t, however, and it doesn’t seem that a single click on the calendar triggers any kind of angular event or even the change event of the widget. After selecting a range (2 clicks), the normal angular digest is triggered and re-evaluation occurs.

    My question boils down to…how do I programatically respond to a single user click of a jqxCalendar? Do I have to manually put a watch on the vm.calendar.selectedDate?

    Clear button for calendar #87987

    Hristo
    Participant

    Hello JellyRaptor,

    You could bind to basic event click on the jqxCalendar (<jqx-calendar jqx-on-click="simpleClick(event)">)

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.