TablixJS jQuery Bundle Constructor Error Fix

Problem Summary

The jQuery bundled version (tablix.jquery.js) was experiencing a constructor error where users got:

TypeError: TablixJS.Table is not a constructor

This occurred because the jQuery wrapper was trying to access the global TablixJS.Table class before it was properly exposed in the UMD bundle execution order.

Root Cause

  1. Execution Order Issue: In the UMD bundle, ES6 import hoisting caused the jQuery wrapper to execute before global variables were set
  2. Global Dependency: The original jQuery wrapper relied on window.TablixJS being available
  3. Timing Problem: jQuery wrapper checked for Table class availability before the bundle had finished exposing it globally

Solution Implemented

1. Created Bundled-Specific jQuery Wrapper

2. Function-Based Initialization

3. Updated Bundle Entry Point

Files Changed

  1. src/jquery/tablixjs-jquery-bundled.js (New)

  2. src/jquery/index.js (Modified)

Verification

The fix has been verified with:

Testing

  1. Automated: node test/verify-jquery-bundle.js
  2. Browser: Open examples/jquery-bundle-fix-test.html
  3. Console: Should see "TablixJS jQuery plugin initialized successfully (bundled version)"

Benefits

  1. Eliminates Constructor Errors: Direct Table class access prevents timing issues
  2. Maintains Compatibility: All existing jQuery plugin APIs work unchanged
  3. Preserves Performance: Minimal bundle size impact
  4. Future-Proof: No longer dependent on global variable timing

Usage Unchanged

Users can continue using the jQuery plugin exactly as before:

// Bundled version usage (FIXED)
$('#table').tablixJS({
  data: myData,
  pagination: { enabled: true }
});

The fix is transparent to end users - no API changes required.