@yuneta/gobj-ui 2.2.4 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15548,7 +15548,13 @@ function create_tabulator(gobj) {
15548
15548
  selectableRows: selectable,
15549
15549
  footerElement: "<span class='yui-tabulator-rowcount' style='display:block;text-align:right;font-size:0.8rem;color:#6b7280;padding:0 0.6rem;'></span>"
15550
15550
  });
15551
- let tabulator = new tabulator_tables.TabulatorFull(`#${table_id}`, tabulator_settings);
15551
+ let $view_container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
15552
+ let $table_el = $view_container ? $view_container.querySelector(`#${table_id}`) : null;
15553
+ if (!$table_el) {
15554
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: table element '#${table_id}' not found in $container`);
15555
+ return;
15556
+ }
15557
+ let tabulator = new tabulator_tables.TabulatorFull($table_el, tabulator_settings);
15552
15558
  function update_rowcount() {
15553
15559
  let $rc = tabulator.element && tabulator.element.querySelector(".yui-tabulator-rowcount");
15554
15560
  if (!$rc) return;
@@ -15543,7 +15543,13 @@ function create_tabulator(gobj) {
15543
15543
  selectableRows: selectable,
15544
15544
  footerElement: "<span class='yui-tabulator-rowcount' style='display:block;text-align:right;font-size:0.8rem;color:#6b7280;padding:0 0.6rem;'></span>"
15545
15545
  });
15546
- let tabulator = new TabulatorFull(`#${table_id}`, tabulator_settings);
15546
+ let $view_container = gobj_read_attr(gobj, "$container");
15547
+ let $table_el = $view_container ? $view_container.querySelector(`#${table_id}`) : null;
15548
+ if (!$table_el) {
15549
+ log_error(`${gobj_short_name(gobj)}: table element '#${table_id}' not found in $container`);
15550
+ return;
15551
+ }
15552
+ let tabulator = new TabulatorFull($table_el, tabulator_settings);
15547
15553
  function update_rowcount() {
15548
15554
  let $rc = tabulator.element && tabulator.element.querySelector(".yui-tabulator-rowcount");
15549
15555
  if (!$rc) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "2.2.4",
3
+ "version": "2.2.5",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -787,7 +787,21 @@ function create_tabulator(gobj)
787
787
  "color:#6b7280;padding:0 0.6rem;'></span>",
788
788
  });
789
789
 
790
- let tabulator = new Tabulator(`#${table_id}`, tabulator_settings);
790
+ /*
791
+ * Attach by ELEMENT, resolved inside OUR $container — a bare `#id`
792
+ * selector needs the element to be in the document already (a view
793
+ * built before being mounted crashes Tabulator: "no element found",
794
+ * then .on() dies on externalEvents null) and is shadowed by any
795
+ * stale duplicate id elsewhere in the page.
796
+ */
797
+ let $view_container = gobj_read_attr(gobj, "$container");
798
+ let $table_el = $view_container ?
799
+ $view_container.querySelector(`#${table_id}`) : null;
800
+ if(!$table_el) {
801
+ log_error(`${gobj_short_name(gobj)}: table element '#${table_id}' not found in $container`);
802
+ return;
803
+ }
804
+ let tabulator = new Tabulator($table_el, tabulator_settings);
791
805
 
792
806
  /* Keep the footer in sync with the visible (active) row count. */
793
807
  function update_rowcount() {