Merge branch 'MDL-68442-master' of git://github.com/andrewnicols/moodle
authorAdrian Greeve <abgreeve@gmail.com>
Wed, 29 Apr 2020 05:52:17 +0000 (13:52 +0800)
committerAdrian Greeve <abgreeve@gmail.com>
Wed, 29 Apr 2020 05:54:57 +0000 (13:54 +0800)
1  2 
lib/table/amd/build/dynamic.min.js
lib/table/amd/build/dynamic.min.js.map
lib/table/amd/build/local/dynamic/selectors.min.js
lib/table/amd/build/local/dynamic/selectors.min.js.map
lib/table/amd/src/dynamic.js
lib/table/amd/src/local/dynamic/selectors.js

index 4632a52,224602f..4054b65
Binary files differ
index 3aef14a,3873913..7334d4e
Binary files differ
@@@ -282,20 -247,23 +282,38 @@@ export const init = () => 
  
              setPageNumber(tableRoot, pageItem.dataset.pageNumber);
          }
 +
 +        const hide = e.target.closest(Selectors.table.links.hide);
 +        if (hide) {
 +            e.preventDefault();
 +
 +            hideColumn(tableRoot, hide.dataset.column);
 +        }
 +
 +        const show = e.target.closest(Selectors.table.links.show);
 +        if (show) {
 +            e.preventDefault();
 +
 +            showColumn(tableRoot, show.dataset.column);
 +        }
 +
      });
  };
+ /**
+  * Fetch the table via its table region id
+  *
+  * @param {String} tableRegionId
+  * @returns {HTMLElement}
+  */
+ export const getTableFromId = tableRegionId => {
+     const tableRoot = document.querySelector(Selectors.main.fromRegionId(tableRegionId));
+     if (!tableRoot) {
+         // The table is not a dynamic table.
+         throw new Error("The table specified is not a dynamic table and cannot be updated");
+     }
+     return tableRoot;
+ };