Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4397 closed defect (fixed)

[PATCH] Mods list doesn't save selected rows and has missed reset

Reported by: Vladislav Belov Owned by: Vladislav Belov
Priority: Should Have Milestone: Alpha 22
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description (last modified by elexis)

Few issues with the mods list:

  1. If you select some row and then change filter and/or order then selection will disappear, but shouldn't, as it's for the replay list.
  2. If you typed something in the filter field, pressed reset, then the field will be cleared, but the list will be filtered like if we'd press apply the filter.
  3. Probably the reset button should reset the sort. order too (asc/desc).

Attachments (4)

4397_selection.patch (1.2 KB ) - added by Vladislav Belov 7 years ago.
Fix the selection
4397_selection_filter.patch (1.7 KB ) - added by Vladislav Belov 7 years ago.
Fix the selection and filter reset
4397_selection_filter_order.patch (1.8 KB ) - added by Vladislav Belov 7 years ago.
Fix the selection, filter reset and order
4397_selection_filter_order.2.patch (1.8 KB ) - added by Vladislav Belov 7 years ago.
Fix the selection, filter reset and order

Download all attachments as: .zip

Change History (13)

by Vladislav Belov, 7 years ago

Attachment: 4397_selection.patch added

Fix the selection

comment:1 by Vladislav Belov, 7 years ago

Keywords: patch rfc added
Milestone: BacklogWork In Progress
Owner: set to Vladislav Belov
Status: newassigned
Summary: Mods list doesn't save selected rows and has missed reset[PATCH] Mods list doesn't save selected rows and has missed reset

by Vladislav Belov, 7 years ago

Attachment: 4397_selection_filter.patch added

Fix the selection and filter reset

comment:2 by Vladislav Belov, 7 years ago

Filter issue was because applyFilters() was called for every changed attribute except the filter field value, but it was the last, so there're no updates after clearing the filter field.

by Vladislav Belov, 7 years ago

Fix the selection, filter reset and order

comment:3 by Vladislav Belov, 7 years ago

Engine.GetGUIObjectByName("modTypeFilter").selected = 0; should be called the last, because only this one have the onChange event and the applyChanges() handler.

comment:4 by elexis, 7 years ago

  • So move the selected = 0 part below the comment or add comment:3 to the code too.
  • Restore previous selected rows -> Restore previously selected rows
  • Does the restoring of the selection throw undefined errors in case of not having any mods in that list?

in reply to:  4 ; comment:5 by Vladislav Belov, 7 years ago

Replying to elexis:

  • Does the restoring of the selection throw undefined errors in case of not having any mods in that list?

Nope, because findIndex() returns -1 if an element not found. Also it applies every time when you change the filter params (so mods just could be filtered).

Last edited 7 years ago by Vladislav Belov (previous) (diff)

by Vladislav Belov, 7 years ago

Fix the selection, filter reset and order

in reply to:  5 ; comment:6 by elexis, 7 years ago

Keywords: review added; rfc removed

Replying to vladislavbelov:

  • Does the restoring of the selection throw undefined errors in case of not having any mods in that list?

Nope, because findIndex() returns -1 if an element not found. Also it applies every time when you change the filter params (so mods just could be filtered).

I was more suspecting the read access to selectedModAvailableFolder. But contrary to other attempted reads of non-existing properties, the comparison doesn't trigger errors, so your code is correct. The following example only triggers errors in the last two statements.

	let a = {};
	let c = a.b;
	warn([1, 2].findIndex(d => d == c));
	warn(c);
	Engine.GetGUIObjectByName("message").caption = c;

Patch valid and tested.

in reply to:  6 comment:7 by Vladislav Belov, 7 years ago

Replying to elexis:

I was more suspecting the read access to selectedModAvailableFolder. But contrary to other attempted reads of non-existing properties, the comparison doesn't trigger errors, so your code is correct. The following example only triggers errors in the last two statements.

	let a = {};
	let c = a.b;
	warn([1, 2].findIndex(d => d == c));
	warn(c);
	Engine.GetGUIObjectByName("message").caption = c;

Invalid index returns undefined, the same logic is used in other places. So it's ok here.

Last edited 7 years ago by Vladislav Belov (previous) (diff)

comment:8 by elexis, 7 years ago

Resolution: fixed
Status: assignedclosed

In 19470:

Restore selected mod and fix reset button in the mod selection screen.

Differential Revision: https://code.wildfiregames.com/D312
Fixes #4397
Patch By: Vladislav

comment:9 by elexis, 7 years ago

Description: modified (diff)
Keywords: review removed
Milestone: Work In ProgressAlpha 22

Thanks for the patch (also I have no recollection of having reviewed this patch half a year ago :D)

Note: See TracTickets for help on using tickets.