Re: Sorting line items (records) via drag-and-drop

926 0
Showing results for 
Search instead for 
Did you mean: 
6 - Interface Innovator
6 - Interface Innovator

I am developing an extension to manage orders based on an ‘Orders’ table and a (linked) ‘Order Line Items’ table. My next objective is to allow line items to be re-ordered by the user via drag-and-drop.

I assume I can achieve this by adding a integer field to the table which gets updated by the drag event (?), but since this actually also is a native Airtable UI functionality and you can order records via drag-and-drop when your table/view isn’t sorted – I’m wondering whether someone knows anything of a custom order index being accessible or anything?

I’m guessing not, since I can’t find anything like that in the API docs…
But maybe you have other ideas to achieve this other than the one I mentioned? Or experience with a similar feat and you’ve got a js library you’d like to suggest or something?

1 Reply 1

Hm, when you do a selectRecordsAsync of the view where the user's re-ordered things via the drag-and-drop, the records are returned in the order displayed in the view the user's doing stuff in, and so I just end up looping through everything and doing a i++ to get a number to sort them by heh