Skip to content

Conversation

@simonLeary42
Copy link
Collaborator

@simonLeary42 simonLeary42 commented Dec 23, 2025

I've long been hacking with tables.js, filter.js and sort.js, and I don't wish to maintain them any longer. https://datatables.net/ is compatible with tables generated by PHP, is open source, is packed with features, looks good enough, and runs fast enough. This is a big improvement for mobile.

groups.php image
pi.php
user-mgmt.php
pi-mgmt.php image image image image image
column visibility selector modal image

Features

  • sorting, filtering, searching
    • datetime sorting
    • numeric sorting
  • pagination
  • stripes
  • highlight on hover
  • hide columns to make table thinner when necessary
    • click on row to reveal hidden columns below transposed
      • in groups.php this is able to replace the expandable ajax functionality from tables.js
      • in pi-mgmt.php this feature could not be used due to the complexity of the expandable content, so the mobile experience is still not great
  • Select which columns to display

Downsides

  • datatables JS files are being loaded on all pages, even pages without tables

    • I plan to fix this by refactoring the <script> elements as separate PHP includes
    • with browser caching this is kind of a non-issue
  • groups.php now loads all PI membership data at once instead of individually for each PI on click

    • this is limited to just the PIs that the current user is a member of, so there should be no performance hit
  • there is a slight delay before the tables are rendered, only noticable on the admin pages with lots of data

    demo with production LDAP data (much bigger than dev environment):
    datatables-user-mgmt-demo-blurred.mp4
    datatables-pi-mgmt-demo-blurred.mp4

Issues Closed

Other Changes of Note

  • Changed "Unity ID" to "GID" in pi-mgmt.php
  • Changed "Pending PI Requests" to "PI Group Requests" in pi-mgmt.php
  • Changed "List of PIs" to "PI Groups" in pi-mgmt.php
  • Removed the prettifying of the Requested On datetime in pi-mgmt so that datatables would automatically detect it and add proper sorting
  • Added column headers to some tables
  • Moved the Actions column in pi.php from the left side to the right side

Future work

@simonLeary42 simonLeary42 changed the title replace custom tables with Datatables replace custom tables with datatables.net Dec 26, 2025
@simonLeary42 simonLeary42 force-pushed the datatables branch 3 times, most recently from 0d45b26 to a84671b Compare December 26, 2025 18:17
@simonLeary42 simonLeary42 force-pushed the datatables branch 2 times, most recently from 1d7acc5 to de73148 Compare December 26, 2025 18:32
@simonLeary42 simonLeary42 requested a review from Copilot December 26, 2025 19:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces custom table implementations with the datatables.net library, modernizing the table functionality across the application. The changes introduce comprehensive table features including sorting, filtering, searching, pagination, and responsive design while removing legacy custom JavaScript and CSS code.

Key changes include:

  • Integration of datatables.net CDN resources for enhanced table functionality
  • Removal of custom table handling code (tables.js, sort.js, filter.js and associated CSS files)
  • Refactoring of AJAX endpoints that previously served expandable table data

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
resources/templates/header.php Added datatables.net CDN includes and removed references to deleted CSS files
webroot/panel/groups.php Converted custom table to DataTable with responsive features and removed AJAX expandable functionality
webroot/panel/pi.php Removed mailto links from email columns for consistency with DataTable output
webroot/admin/user-mgmt.php Replaced custom filterable/sortable table with DataTable implementation
webroot/admin/pi-mgmt.php Converted both PI request and PI list tables to DataTable format with responsive design
webroot/js/tables.js Removed legacy expandable table JavaScript functionality
webroot/js/sort.js Removed custom sorting implementation
webroot/js/filter.js Removed custom filtering implementation
webroot/css/tables.css Removed custom table styling
webroot/css/filters.css Removed custom filter styling
webroot/panel/ajax/get_group_members.php Removed AJAX endpoint as group members are now loaded inline
webroot/admin/ajax/get_group_members.php Removed AJAX endpoint as group members are now loaded inline
resources/lib/UnityLDAP.php Added new method to fetch PI group attributes with member UID filter
tools/docker-dev/identity/bootstrap.ldif Updated test user email address

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@simonLeary42 simonLeary42 marked this pull request as ready for review December 26, 2025 19:13
@simonLeary42 simonLeary42 force-pushed the datatables branch 2 times, most recently from 6132809 to 9c25c69 Compare December 26, 2025 20:22
@simonLeary42 simonLeary42 marked this pull request as draft December 29, 2025 17:40
@simonLeary42 simonLeary42 removed the request for review from bryank-cs December 29, 2025 17:40
@simonLeary42 simonLeary42 force-pushed the datatables branch 3 times, most recently from e75bcce to 389868f Compare December 29, 2025 19:31
@simonLeary42 simonLeary42 marked this pull request as ready for review December 29, 2025 19:37
@simonLeary42
Copy link
Collaborator Author

simonLeary42 commented Dec 31, 2025

  • TODO

problem: get_group_members.php has a feature where an admin can approve and deny users' membership requests, which is now gone.

see reqChild

Removed unused Actions column in pi-mgmt.php

Was not actually unused

@simonLeary42 simonLeary42 marked this pull request as draft December 31, 2025 21:10
@simonLeary42 simonLeary42 force-pushed the datatables branch 5 times, most recently from 5f3ef13 to ad3e7ea Compare January 7, 2026 13:50
@simonLeary42 simonLeary42 marked this pull request as ready for review January 7, 2026 14:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 18 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@simonLeary42 simonLeary42 requested a review from bryank-cs January 7, 2026 14:31
@simonLeary42 simonLeary42 merged commit 604039f into main Jan 16, 2026
3 checks passed
@simonLeary42 simonLeary42 deleted the datatables branch January 16, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants