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

Disable day view on date click #325

Closed
TommyZG opened this issue Jun 13, 2014 · 6 comments
Closed

Disable day view on date click #325

TommyZG opened this issue Jun 13, 2014 · 6 comments

Comments

@TommyZG
Copy link
Contributor

TommyZG commented Jun 13, 2014

Hi,

When you click the number in month view, you get day view. How can I disable this behaviour? I don't want anything to happen if someone clicks the number.

I'm new to JS, of course, so I would appreciate something like "in app.js add option something something" because I don't know what it means to "unbind event" :) Thanks!

@daniel-obadia
Copy link

This code snippet seemed to work for me, however, I was unable to unbind the double click.

Hope this helps :

      $( "*[data-cal-date]").unbind( "click" );

I also tried to unbind double click with this :

$("*[data-cal-date]").dblclick(function(){
        event.preventDefault();
        $( "*[data-cal-date]").unbind( "dblclick" );
      });

      $(".cal-cell").dblclick(function(){
        event.preventDefault();
        $( "*[data-cal-date]").unbind( "dblclick" );
        alert("dbclick");
      });

Ended up having to comment line 937 to 941 in the calendar.js file

     $('.cal-cell').dblclick(function() {
        var view = $('[data-cal-date]', this).data('cal-view');

@TommyZG
Copy link
Contributor Author

TommyZG commented Jun 18, 2014

Thank you very much, I just commented out lines https://github.com/Serhioromano/bootstrap-calendar/blob/master/js/calendar.js#L934-L943 and now it is perfect - click and doubleclick opens the bottom drawer. Great!

@TommyZG TommyZG closed this as completed Jun 18, 2014
@Matthieusch
Copy link

Simply do this.

var calendar = $el.calendar({
    tmpl_path: "/tmpls/",
    views: {
      year:  {
        enable: 1
      },
      month:  {
        enable: 1
      }
      week:  {
        enable: 1
      },
      day:   {
        enable: 0 //disabled
      }
    }
});

@renaudjenny
Copy link

@Matthieusch This solution is perfect for me! Is there a Wiki or something else where all calendar "constructor options" are explained?

@Matthieusch
Copy link

Hi @renaudjenny, I had to check sources to find it in : https://github.com/Serhioromano/bootstrap-calendar/blob/master/js/calendar.js line 95.

@renaudjenny
Copy link

@Matthieusch Oh great! It's right that this part explains all options by itself. Thanks again 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants