Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to enable especific days #98

Merged
merged 1 commit into from May 4, 2016
Merged

Conversation

@Gabrielr47
Copy link
Contributor

Gabrielr47 commented May 3, 2016

If you want to choose witch days will be enable Is just to put on the options.

$('#date').bootstrapMaterialDatePicker({
      time: false,
      clearButton: true,
      enableDays: [3, 5]
});

Demo.

Add on the plugin:

enableDays: function() {
  var enableDays = this.params.enableDays;
  if (enableDays) {
    $(".dtp-picker-days tbody tr td").each(function() {
      if (!(($.inArray($(this).index(), enableDays)) >= 0)) {
        $(this).find('a').css({
          "background": "#e3e3e3",
          "cursor": "no-drop",
          "opacity": "0.5"
        }).off("click");
      }
    });
  }
}

Then Just init on the focus event :)

now you can just add the days that you need to display like:   enableDays: [3, 5] in the options param
@T00rk

This comment has been minimized.

Copy link
Owner

T00rk commented May 4, 2016

Nice job, can you just change the background of disabled days and set it to white please ?

@Gabrielr47

This comment has been minimized.

Copy link
Contributor Author

Gabrielr47 commented May 4, 2016

Hi,

The pattern background is white, I put gray to be clear that was disabled.
If white will be better just remove the line with:"background": "#e3e3e3",

@T00rk T00rk merged commit c506107 into T00rk:gh-pages May 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.