I have a watchlist containing a list of stocks, and one of the popular usages of such a list is rearranging the rows (dragging and dropping selected rows to a favorite user position). Now, let's add a sort functionality to that list, and we have a logic problem; sorting the list will affect the position of my dragged row. What are some best practices to handle this situation? Some possible solutions: 1.Avoid drag & drop for the rows. 2. Ditch the sorting and keep the rows rearrangement. 3.Create some custom solution pinning the dragged rows to the top in some way. 4.Sort the list from scratch and let the user drag and drop his rows again, but this is for sure a bad user experience. I wonder if other platforms are dealing with such problems? Do you know if there're references to a solution or a nearby solution? Is it always one solution and the two cannot live together?

I'll be happy to hear your thoughts.

  • Perhaps the "pinning" concept would help clarify what you're trying to do. If I pin items to indices 0, 1, 2, 8, and 12, neither those items nor those indices are involved in a sort. If this behaviour surprises me, I can clear pins individually or all at once and sorry again. Jun 20, 2021 at 13:02
  • Pining was just an option; my main goal is to have a list table with two functions, sort per user selection (he chooses which column to sort) or drag and drop rows per my selection which will conflict with the column sort. Wonder if there's a way to solve this.
    – Guy Cohen
    Jun 21, 2021 at 8:05
  • Why is rearranging rows a popular usage? Knowing what the reason is seems crucial for an answer.
    – jazZRo
    Jun 21, 2021 at 9:17
  • Analytic based, this is a 10M MAU project, there are 3% + users who are using it.
    – Guy Cohen
    Jun 21, 2021 at 10:05

2 Answers 2


A drag and drop feature would be the most intuitive option. A user who is interested in moving an entire row to a new position would find it easy to just grab the row (usually indicated with the grid icon) and either drag it and have it drop after they release the mouse, or have the ui update as the they are dragging the row. Now the dragging of rows can become difficult in a large table. Then you could be dragging a row while scrolling. In that case, an alternative would be to add some kind of checkbox - activate tools for row sorting option. A user can activate a row by clicking a checkbox next to the row that would then display tools to allow them to make complex decisions for where they want to place the row. After they move the row, there should be a save and undo option. Hope that helps.

I found this article interesting https://trumpexcel.com/move-rows-columns/


I don't think this is an issue because more advanced data tables or sorted lists provide the type of features that indicate which column or data field the data is currently being sorted on (which by default would probably be the first column), or allow you to sort by multiple columns (using a priority list like Excel). This is in addition to features like the rearrangement of column orders and also to hide or show columns.

They will also allow you to select individual rows and manipulate them, such as perform specific actions to modify the state of that row, and perhaps allow you to pin them to a specific position (e.g. at the top of the table).

When you have done these manipulations, you can then save it as a particular view that you can go back to, in addition to the default view.

  • I know but the problem is not columns rearrange vs. sorting, the problem is row rearrange vs. column sorting, If you have a reference to a complex sorting vs. drag & drop rows I'll be happy to see it. thanks!
    – Guy Cohen
    Jun 21, 2021 at 8:03
  • @GuyCohen sorry, I didn't read the question properly :p I have updated the answer to provide options like pinning a row to the top of the table/list as an option. It looks like you might have to work out whether a data table or a sorted list fits your data better (depending on how many fields you display in the watch list).
    – Michael Lai
    Jun 21, 2021 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.