Skip to content

Conversation

@ahpang
Copy link
Contributor

@ahpang ahpang commented Sep 30, 2025

🚀 Major Update: DataTables v2.0 Migration

This PR modernizes the yii2-datatables extension by upgrading to DataTables v2.0 and migrating from deprecated Bower assets to NPM assets, ensuring better long-term maintainability and compatibility.

⚠️ Breaking Changes

  • PHP Version: Minimum PHP version upgraded from >=5.5.0 to >=7.4.0
  • Yii2 Version: Minimum Yii2 version upgraded from ~2.0.13 to ~2.0.50
  • DataTables Version: Upgraded from ~1.10.15 to ^2.0
  • Asset Management: Migrated from Bower assets (bower-asset/*) to NPM assets (npm-asset/*)

📦 Updated Dependencies

➕ Added Dependencies:

  • npm-asset/datatables.net: ^2.0 (Core DataTables)
  • npm-asset/datatables.net-dt: ^2.0 (Default styling)
  • npm-asset/datatables.net-jqui: ^2.0 (jQuery UI integration)
  • npm-asset/datatables.net-bs: ^2.0 (Bootstrap 3 integration)
  • npm-asset/datatables.net-bs4: ^2.0 (Bootstrap 4 integration)
  • npm-asset/datatables.net-bs5: ^2.0 (Bootstrap 5 integration)
  • npm-asset/datatables.net-plugins: ^2.0 (Additional plugins)

➖ Removed Dependencies:

  • bower-asset/datatables (~1.10.15)
  • bower-asset/datatables-plugins (~1.10.15)
  • bower-asset/datatables.net-bs4 (~1.10.15)

🛠️ Technical Changes

Asset Bundle Updates:

  1. DataTableBaseAsset.php:

    • Updated source path from @bower/datatables/media to @npm/datatables.net
    • Fixed JavaScript file reference for DataTables v2.0 naming convention
  2. DataTableBootstrapAsset.php:

    • Updated all Bootstrap integration source paths to use NPM assets
    • Fixed file path separators (changed \ to / for cross-platform compatibility)
    • Updated CSS/JS file references for all Bootstrap versions (3, 4, 5)
  3. DataTableDefaultAsset.php:

    • Updated source path to @npm/datatables.net-dt
    • Added proper initialization with CSS file references
    • Removed duplicate JS references (handled by base asset)
  4. DataTableJuiAsset.php:

    • Updated source path to @npm/datatables.net-jqui
    • Fixed file references for jQuery UI integration
  5. DataTableAsset.php:

    • Fixed missing default case in styling switch
    • Added proper DefaultAsset dependency for default styling
  6. DataTableFaAsset.php:

    • Added missing sourcePath for FontAwesome integration

Configuration Cleanup:

  • Removed deprecated fxp-asset configuration block from composer.json

📚 Documentation Updates

  • CHANGELOG.md: Added comprehensive v2.0.0 changelog entry
  • README.md: Updated installation instructions and system requirements
  • MIGRATION.md: Created detailed migration guide for users upgrading from v1.x

Benefits

  • 🔮 Future-Proof: Uses actively maintained NPM packages instead of deprecated Bower
  • ⚡ Performance: DataTables v2.0 includes performance improvements and bug fixes
  • 🔒 Security: Updated to modern PHP version with security improvements
  • 🔗 Compatibility: Better compatibility with modern Yii2 installations
  • 🧹 Maintenance: Simplified asset management without Bower dependencies

🧪 Testing Checklist

  • All styling options (Default, Bootstrap 3/4/5, jQuery UI)
  • Asset bundle loading and file paths
  • Cross-platform compatibility (Windows/Linux/Mac)
  • Asset file references and dependencies

📋 Migration Guide

Users updating to this version should:

  1. Ensure PHP >= 7.4.0 and Yii2 >= 2.0.50
  2. Run composer update to get updated dependencies
  3. Clear asset cache: php yii asset/clear
  4. Follow the detailed Migration Guide for step-by-step instructions
  5. Test DataTable functionality in their applications

🏷️ Version Impact

This should be released as a major version (v2.0.0) due to breaking changes in minimum requirements.

🔗 Related Issues

  • Resolves dependency on deprecated Bower packages
  • Modernizes DataTables to latest v2.0 with performance improvements
  • Ensures compatibility with modern PHP and Yii2 versions

⚠️ IMPORTANT: This is a major version upgrade with breaking changes. Please review the Migration Guide before merging.

@ZAYEC77
Copy link
Contributor

ZAYEC77 commented Sep 30, 2025

Hello @ahpang
Thank you for your PR, I’ll review it soon.
I’m not sure that I’ll be able to release new version.
Maybe it will be simpler if you release your fork if you need it fast.

@ZAYEC77 ZAYEC77 merged commit 94e6bed into NullRefExcep:master Sep 30, 2025
@ZAYEC77
Copy link
Contributor

ZAYEC77 commented Sep 30, 2025

@ahpang maybe you would like to check this?
#73

@ahpang ahpang deleted the feat/update-library-version branch October 1, 2025 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants