#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 )
Few issues with the mods list:
- 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.
- 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.
- Probably the reset button should reset the sort. order too (asc/desc).
Attachments (4)
Change History (13)
by , 7 years ago
Attachment: | 4397_selection.patch added |
---|
comment:1 by , 7 years ago
Keywords: | patch rfc added |
---|---|
Milestone: | Backlog → Work In Progress |
Owner: | set to |
Status: | new → assigned |
Summary: | Mods list doesn't save selected rows and has missed reset → [PATCH] Mods list doesn't save selected rows and has missed reset |
comment:2 by , 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 , 7 years ago
Attachment: | 4397_selection_filter_order.patch added |
---|
Fix the selection, filter reset and order
comment:3 by , 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.
follow-up: 5 comment:4 by , 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?
follow-up: 6 comment:5 by , 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).
by , 7 years ago
Attachment: | 4397_selection_filter_order.2.patch added |
---|
Fix the selection, filter reset and order
follow-up: 7 comment:6 by , 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.
comment:7 by , 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, I'm not mistaken. So it's ok here.
comment:9 by , 7 years ago
Description: | modified (diff) |
---|---|
Keywords: | review removed |
Milestone: | Work In Progress → Alpha 22 |
Thanks for the patch (also I have no recollection of having reviewed this patch half a year ago :D)
Fix the selection