Updating table display order when select box in datatable column changed
Updating table display order when select box in datatable column changed

Hi ,
Have taken over converting a desktop app from Delphi to PHP, and trying to work out how to move a certain piece of logic.(a class register)
Have a datatable with several columns, Name, Group and several columns with checkboxes.
The Group column rows are select dropdowns with a choice of between 1 and 4 items.
Currently the data is imported from a MySQL database ordered by Group and Name.
Ordering by column is disabled, as the number of checkbox columns is variable, and don't want it sorted by any of those columns.
Everything works ok, with the correct select item displayed for each row record.
However I would like it so that if the group select is changed for a row the table automatically updates the display order.
e.g. Say items are:
John Ames, Group1,
Joan Doe, Group 1
Bill Lyons, Group 1
Don Bloggs, Group 2
Fred Zimbo, Group 2
Sam Mathews, Group 3
If Don Bloggs is changed to Group 1 then the table should update to show him listed between John Ames and Joan Doe..
I have tried using the Row Grouping example as a starting place, but not getting anywhere with it.
Help appreciated
Answers
Hi @WaspFan ,
I would expect that to happen, but it depends on how you're updating the data - you may need to call
draw()
or possibly invalidate the original data withcell().invalidate()
or `-api row().invalidate().If that doesn't help, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Sorry for delay in answering - day job took over!
When I'm back, next week I'll put a test example up.
Thanks