day-schedule-selector icon indicating copy to clipboard operation
day-schedule-selector copied to clipboard

Add Clear selections

Open Java-Jim opened this issue 9 years ago • 0 comments

I added a function in index.js to clear the selcted time-slots. You could add it to the git.

  /**
   * Clear the selections
   * @public
   */
  DayScheduleSelector.prototype.clear = function () {
    var plugin = this

    $.each(this.options.days, function (_, v) {
      plugin.$el.find(".time-slot[data-day='" + v + "']").each(function () {
        if (isSlotSelected($(this))) {
        plugin.deselect($(this));       
        }
      });
    })
  };

To run it, call

$("#day-schedule").data('artsy.dayScheduleSelector').clear();

Java-Jim avatar Nov 09 '15 13:11 Java-Jim