Why is UIGridStyleLayout.SetCustomSortFunction deprecated?
It was difficult to use and can have unexpected behaviour when the provided sort function isn’t fully deterministic for all cases, which is a difficult property to check since the comparator is a custom function. Overall, it wasn’t deemed a good idea to have this API.
The (better) alternative is setting the SortOrder to “LayoutOrder” and then using GuiObject’s LayoutOrder property to sort the objects appropriately. You can for example take your table with objects, sort it using table.sort, and then set LayoutOrder for each UI item in your grid as the index in the table.
See here for more info and an example place:
https://devforum.roblox.com/t/roblox-version-303-is-live/48886/29
3 Likes