Calendar previous and next month buttons do not load the months

Created on 25 April 2024, 8 months ago

Whenever I hit the next or previous buttons on the calendar view, I get this error in my console and the Calendar stays on the current month.

Uncaught TypeError: Cannot read properties of null (reading 'removeAttribute')
at Drupal.Message.defaultWrapper (message.js?v=10.2.3:43:17)
at new Drupal.Message (message.js?v=10.2.3:26:46)
at new Drupal.AjaxError (ajax.js?v=10.2.3:184:35)
at Drupal.Ajax.error (ajax.js?v=10.2.3:1219:11)
at Object.complete (ajax.js?v=10.2.3:608:23)
at c (jquery.min.js?v=3.7.1:2:25304)
at Object.fireWith (jquery.min.js?v=3.7.1:2:26053)
at l (jquery.min.js?v=3.7.1:2:77910)
at XMLHttpRequest. (jquery.min.js?v=3.7.1:2:80265)

πŸ› Bug report
Status

Active

Version

2.1

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ryanknighton
  • Does this happen with the same view but a different format - such as Table or Unformatted list?

  • This happens with the same view and different formats. I am using the Calendar By Month view. It works in the view preview page but not the website page itself.

  • πŸ‡ΊπŸ‡ΈUnited States micnap

    Same issue for me. Using the Month format and have unchecked the "Use "Previous/Next" labels" checkbox in the Pager settings. The previous and next links show as the previous and next month names in the view preview. But on the actual page with the calendar, they still show as Previous and Next.

  • Status changed to Postponed: needs info 8 months ago
  • Several information I m not sure I understand here, sorry.

    @ryanknighton can you try with a different view style, such as Table or Unformatted list please ?

    If the problem occurs with a totally different view style - not a Calendar View display - therefore it is not related to this module. It will be related to your theme or something on your frontend - plus you said everything work in preview on the back. I am quite sure your Ajax issue is not related to Calendar. Looking forward to hearing from you.

    @micnap I think this is a totally different issue. Do you mind opening a bug report? Please give details about your version of the Calendar View module and your view configuration - I do not reproduce the issue on the dev branch thus I guess you might be using an old release. Thanks.

  • This problem occurs with table, unformatted list, grid, etc. And like I said, it does work in preview mode so it must be something on my end. That helps me. I'll dig around deeper and see what I can find. Thanks!

  • This is resolved. I had to turn off Use Ajax in the view. I'm an idiot. Thanks for all your help @matthieuscarset!

  • Status changed to Closed: works as designed 8 months ago
  • I am using Drupal 10.3.6

    Machine name: calendar_view
    Version: 2.1.10

    The next and previous buttons are not working

    Here is my YAML structure

    uuid: ec4911e7-94b6-4b43-a02c-1a5d05a55f56
    langcode: en-gb
    status: true
    dependencies:
    module:
    - calendar
    - calendar_view
    - datetime
    - node
    - user
    id: calender_test
    label: 'calender test'
    module: views
    description: ''
    tag: ''
    base_table: node_field_data
    base_field: nid
    display:
    default:
    id: default
    display_title: Default
    display_plugin: default
    position: 0
    display_options:
    title: 'calender test'
    fields:
    title:
    id: title
    table: node_field_data
    field: title
    relationship: none
    group_type: group
    admin_label: ''
    entity_type: node
    entity_field: title
    plugin_id: field
    label: Title
    exclude: false
    alter:
    alter_text: false
    make_link: false
    absolute: false
    word_boundary: false
    ellipsis: false
    strip_tags: false
    trim: false
    html: false
    element_type: ''
    element_class: ''
    element_label_type: ''
    element_label_class: ''
    element_label_colon: true
    element_wrapper_type: ''
    element_wrapper_class: ''
    element_default_classes: true
    empty: ''
    hide_empty: false
    empty_zero: false
    hide_alter_empty: true
    click_sort_column: value
    type: string
    settings:
    link_to_entity: true
    group_column: value
    group_columns: { }
    group_rows: true
    delta_limit: 0
    delta_offset: 0
    delta_reversed: false
    delta_first_last: false
    multi_type: separator
    separator: ', '
    field_api_classes: false
    pager:
    type: calendar_month
    options:
    offset: 0
    display_reset: 1
    use_previous_next: 1
    label_format: F
    exposed_form:
    type: basic
    options:
    submit_button: Apply
    reset_button: false
    reset_button_label: Reset
    exposed_sorts_label: 'Sort by'
    expose_sort_order: true
    sort_asc_label: Asc
    sort_desc_label: Desc
    access:
    type: perm
    options:
    perm: 'access content'
    cache:
    type: none
    options: { }
    empty: { }
    sorts:
    created:
    id: created
    table: node_field_data
    field: created
    relationship: none
    group_type: group
    admin_label: ''
    entity_type: node
    entity_field: created
    plugin_id: date
    order: DESC
    expose:
    label: ''
    field_identifier: ''
    exposed: false
    granularity: second
    arguments:
    field_event_date_value_year_month:
    id: field_event_date_value_year_month
    table: node__field_event_date
    field: field_event_date_value_year_month
    relationship: none
    group_type: group
    admin_label: ''
    plugin_id: datetime_year_month
    default_action: default
    exception:
    value: all
    title_enable: false
    title: All
    title_enable: false
    title: ''
    default_argument_type: date
    default_argument_options: { }
    summary_options:
    base_path: ''
    count: true
    override: false
    items_per_page: 25
    summary:
    sort_order: asc
    number_of_records: 0
    format: default_summary
    specify_validation: false
    validate:
    type: none
    fail: 'not found'
    validate_options: { }
    filters:
    status:
    id: status
    table: node_field_data
    field: status
    entity_type: node
    entity_field: status
    plugin_id: boolean
    value: '1'
    group: 1
    expose:
    operator: ''
    style:
    type: calendar
    options:
    calendar_type: month
    mini: '0'
    link_to_date: '1'
    month_name_size: '99'
    name_size: '3'
    with_weekno: '0'
    max_items: '0'
    max_items_behavior: more
    groupby_times: hour
    groupby_times_custom: null
    theme_style: '1'
    groupby_field: ''
    multiday_theme: '1'
    multiday_hidden: { }
    granularity_links:
    day: ''
    week: ''
    month: ''
    row:
    type: calendar_row
    options:
    colors:
    legend: None
    calendar_colors_type:
    event: '#ffffff'
    article: '#ffffff'
    page: '#ffffff'
    query:
    type: views_query
    options:
    query_comment: ''
    disable_sql_rewrite: false
    distinct: false
    replica: false
    query_tags: { }
    relationships: { }
    use_ajax: false
    header:
    calendar_header:
    id: calendar_header
    table: views
    field: calendar_header
    relationship: none
    group_type: group
    admin_label: ''
    plugin_id: calendar_header
    empty: true
    tokenize: 1
    content: ''
    pager_embed: 1
    footer: { }
    display_extenders: { }
    cache_metadata:
    max-age: 0
    contexts:
    - 'languages:language_content'
    - 'languages:language_interface'
    - url
    - 'user.node_grants:view'
    - user.permissions
    tags: { }
    page_1:
    id: page_1
    display_title: Page
    display_plugin: page
    position: 1
    display_options:
    display_extenders: { }
    path: calender-test
    cache_metadata:
    max-age: 0
    contexts:
    - 'languages:language_content'
    - 'languages:language_interface'
    - url
    - 'user.node_grants:view'
    - user.permissions
    tags: { }

    On the Contextual filter, I have added a date field:
    https://www.drupal.org/files/issues/2024-11-25/calenderview-formate.png β†’

    Formate:
    https://www.drupal.org/files/issues/2024-11-25/calenderview-formate.png β†’

    Pager:
    https://www.drupal.org/files/issues/2024-11-25/calenderview-pager.png β†’

    Even if I enabled Ajax previous and next month's buttons are not working

    The current November month is shown as the default:
    Next link: ?calendar_timestamp=1733011200&previous=1727740800&current=1732533569&next=1733011200&date_format=custom&date_pattern=F&use_previous_next=1&display_reset=1&pager_type=calendar_month

    Previous link: ?calendar_timestamp=1727740800&previous=1727740800&current=1732533729&next=1733011200&date_format=custom&date_pattern=F&use_previous_next=1&display_reset=1&pager_type=calendar_month

Production build 0.71.5 2024