admin2: fixed various sorting related gridlist issues #416
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
guiGridListSetItemText and guiGridListSetItemData can affect unintended rows when user-sorting is used in conjunction with the search-filter, causing the text or data to apply to an incorrect row and therefore disappear for the intended row with the current way admin2 refreshes the gridlists. In some cases it's a big deal, because it can cause the gridlist to malfunction until admin2 is reloaded. Rather than disabling user-sorting for all gridlists we can use the optional arguments of guiGridListAddRow wherever possible, and store, disable and re-apply the GUI property "SortDirection" for the remaining cases, to ensure proper application.
This pull request currently fixes the following GUI gridlists:
/client/main/admin_players.lua -> aPlayersTab.PlayerList
/client/main/admin_resources.lua -> aResourcesTab.ResourceList
/client/widgets/admin_interior.lua -> aInterior.List
/client/widgets/admin_skin.lua -> aSkin.List
/client/widgets/admin_team.lua -> aTeam.List
/client/widgets/admin_vehicle.lua -> aVehicle.List
/client/widgets/admin_weapon.lua -> aWeapon.List
Notably it's currently not changing these GUI gridlists:
/client/main/admin_acl.lua -> aAclTab.RightsTab (Benefit from changes would be diminished, as clearing all columns (which is done a lot here) circumvents the problem as well. Main remaining benefit would be to preserve user-sorting after input in the search-filter)
/client/main/admin_bans.lua -> aBansTab.BansList (Bans are currently a large WIP in another branch, so I decided to not change this one for now)
Three small additional fixes were made: one removing tabs in favor of 4 spaces to match coding style in admin_players.lua; fixed an incorrectly named setting to have admin2 remember the users sort vehicles by vehicle groups preference; and the team widget will now close correctly when assigning a player a team via double click.
See line comments on commits for more explanation.