-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
list not displaying content when filtered by custom attribute #60
Comments
@vegarringdal mentioned to me that
I have not been able to check that, yet. |
Please note that the above quote is an assumption, not a fact. 😄 |
Just to clarify what's going on. You have a list of items, you scroll down a bit so that there are items that are no longer in the DOM "above" where you're looking. You then trigger a filter that filters the items in the list so you have less items than before, but your scroll position stays in the same location, and therefore you don't see any items. But if you scrolled to the top, you'd see everything correctly. Is that correct? |
@AStoker I'm not sure if that's correct.. 😄
Now with scrolling up before triggering the filter:
|
Update: in the first case, if I scroll to the bottom ( Currently failing to do that as a workaround in my app.. |
Can I do anything to help with this? Last time I've tried the following: this.list.scrollTop = 0;
window.setTimeout(() => {
this.showOnlySelected = !this.showOnlySelected;
}, 500); (500ms was really needed in this case) To be more precise: So the new array is rendered but there are no checkboxes (should be filled) and no names (right to the checkboxes). |
Hi, gave this a try. If I replace let first = repeat._getIndexOfFirstView(); I get @Thanood filtering to work, this change will calculate what the first index should be compared to scrolltop, because it was no correct when you had scrolled when I tried. I have no idea if I broke something else with this... BTW, would have been nice when running the sample, if the source maps for ui-virtualization was included when running downloading and running the sample, so much easier to debug, but again think I have to fix this in aurelia-v-grid too:joy: |
I can confirm that @vegarringdal's change solves this problem for my use-case. 👍 😄 |
This is still bugging me. 😃 If you put a log line in there which prints
If you have a list with 81 viewSlots and have scrolled down, then get the first one you receive the first visible index (say it's I'm wondering.. Shouldn't the viewSlot while (viewsLength > itemsLength) {
viewsLength--;
repeat.removeView(viewsLength, true);
} Sorry, if that's a stupid question, the internals still escape me somehow. 😃 |
It works as expected when you return the actual index of the first view in the viewSlot array as opposed to the index of its _getIndexOfFirstView(): number {
return this.view(0) ? this.view(0).overrideContext.$index : -1;
} https://github.com/aurelia/ui-virtualization/blob/master/src/virtual-repeat.js#L404-L406 With this: _getIndexOfFirstView(): number {
return this.view(0) ? this.viewSlot.children.indexOf(this.view(0)) : -1;
} It works as I would expect it. EDIT: These two tests also fail (in the same way) when I revert the change I did. 😃
|
Does that even make sense..? It's always at |
@Thanood |
@vegarringdal I'm not sure about its side effects and there has been no comment about it. (or in other words: not sure if it breaks anything 😏 ) |
I will try it when I get home. 😃 |
@AStoker I can confirm this issue is fixed using my reproduction repo: http://github.com/Thanood/ui-virt-filter-issue ✨ 👍 |
Thanks! I'll try and get this in shortly |
Resolved (hopefully) by #107 |
When filtering a list using value converters (not sure if this is the cause, but anyway) the resulting list is essentially empty. The data is still there (
this.items
contains the correct data).In addition to being "empty" the list is displayed in a different order when removing the filter.
It's reproduced here: https://github.com/Thanood/ui-virt-filter-issue
Steps to reproduce:
It's interesting that if you scroll to the top before enabling the filter, everything is okay.
The text was updated successfully, but these errors were encountered: