Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-85007

Dynamic table triggers updated events in wrong table instances

XMLWordPrintable

    • 2
    • WP Sprint 2025-I1.3 (Clones)

      The code for dynamically updating table content is thus:

      https://github.com/moodle/moodle/blob/89d76fdc25ead41d29253972c45268a21dae7633/lib/table/amd/src/dynamic.js#L91-L101

      The problem is that the table that is being dynamically updated is not necessarily the same table upon which we dispatch the event

      The problem is the same as reported in MDL-85001 - when there are two of the same report builder reports on a page (similar scenario as described in that issue, e.g. multiple blocks, each pointing at the same report), then events that should be triggered for the second report are instead triggered for the first instance of the report in the DOM

      This is because getTableFromId(tableRoot.dataset.tableUniqueid); will return the same value for each table, because they each have the following attribute:

      data-table-uniqueid="custom-report-table-306"
      

      This problem could be reproduced in Moodle if ever a situation arose where the same dynamic table was rendered multiple times in DOM, however it's more prevalent in Workplace with our report block and the chart visualisation project

        1. MDL-85007.png
          324 kB
          Ron Carl Alfon Yu

            pholden Paul Holden
            pholden Paul Holden
            Pedro Jordao Pedro Jordao
            Jake Dallimore Jake Dallimore
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 17 minutes
                4h 17m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.