Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ligonsker's avatar

Approach for editing specific table columns

If there's a table that fetches thousands of rows from the database, with each row having about 20 columns that each can be edited by the user - what should the approach for that be? (The table is Bootstrap / HTML table)

the design itself is simple - the table cells look like inputs - mostly text (some selects), and the user can simply edit the data that was fetched from the DB, then click Save button to update the database with the new data.

I was thinking about having each row with the unique ID from the database as a data-attribute (maybe even use UUID), then whenever the user changes data, add this in the frontend with JavaScript to an array of objects containing the unique ID and any cell that was changed for this ID. then using AJAX to update the data whenever the user clicks Save.

Is this a good approach? Or you'd do something else? Ty!

0 likes
2 replies
neilstee's avatar

@ligonsker I don't see any issues on your approach and I will do the same honestly. Just make sure you only send IDs and fields that has been change to avoid unnecessary saving of data.

Sinnbeck's avatar

Don't load thousands of rows at once. Use pagination

Please or to participate in this conversation.