It have two table parent table and children table
Children Table (where parent_id = id) id from parent table
Im using PDO mysql for data fetch
above picture is dashboard where data is displayed from database
now user should be able re-order the rows either by input value or drag drop
how can user can re-order the row from dashboard
what will be the process for this re-ordering rows. i count find the solution
solve with the concept of picture-3, still wondering if i could do it with drag and drop
How is the order determined? From something that’s already there, or do you want to allow the user to choose a “display order” that isn’t based on a normal sort on existing data? If the latter, you’ll probably need to add a column to the table that contains the users specific chosen sequence, and use that in your
ORDER BY clause.
It is not easy. But yes for the UI drag-and-drop can be useful. There are other options; you have seen other options.
The hard part is the database. I struggled with a similar problem extensively. I am going to try to make it seem really hard to motivate you to search for previous answers so you can prove me wrong. You need to do that.
One problem I had is the database update. If you store the order number in the database and if you want to avoid replacing all the data (to avoid bad performance) each time the order number is changed then a likely result will be frustration.
The database is the hard part. I said that already, but it needs to be emphasized. If it is possible to store the order number outside the database then that can make things easier, or in a separate table.
So you want to order children of a given parent only? Each parent has their own order set?
Not so difficult really.
INSERT INTO children (child_id,order) VALUES (X1,O1), (X2,O2).... ON DUPLICATE KEY UPDATE order=VALUES(order)
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.