shlomiassaf/ngrid

Infinite Scroll DataSource ignores all triggers

ronnetzer opened this issue · 6 comments

What is the expected behavior?

When using custom triggers or manually refreshing the dataSource, the onTrigger handler should've been called.

What is the current behavior?

Currently, onTrigger handler is not being called for events other than scroll.
Also for the first emit (when isInitial is true), all triggers are marked as changed (data, filter, etc), I'm not sure if this is the correct behavior.

What are the steps to reproduce?

https://stackblitz.com/edit/pebula-ngrid-starter-vcrf9e
I've added a button in app.component above the table that calls refresh and setFilter.
Also added console.log in onTrigger for data and filter changes, you can see they're not being called.

Which versions of Angular, CDK, Material, NGrid, OS, TypeScript, browsers are affected?

latest versions (used your starter to reproduce)

Is there anything else we should know?

This lib is awesome, thank you for all of your hard work 👍

@shlomiassaf The default material sort breaks after upgrading to 2.2.2

@ronnetzer Can you elaborate?

The default material sort when using infinite scroll?

There's no client sort/filter/pagination with infinite scroll, the model does not allow it.
If you want sorting you must handle them via customTriggers.

I hope I understood what you wanted to say

@shlomiassaf Thanks, you got it right.

There's no client sort/filter/pagination with infinite scroll, the model does not allow it.
If you want sorting you must handle them via customTriggers.

Consider adding it to the docs (maybe it's there and I've missed it)

@shlomiassaf invoking refresh still doesn't trigger the handler, updated the stackblitz
https://stackblitz.com/edit/pebula-ngrid-starter-vcrf9e

@shlomiassaf Thanks, you got it right.

There's no client sort/filter/pagination with infinite scroll, the model does not allow it.
If you want sorting you must handle them via customTriggers.

Consider adding it to the docs (maybe it's there and I've missed it)

I've added it to the docs along with the fix, so you probably missed it

https://shlomiassaf.github.io/ngrid/features/grid/infinite-scroll#custom-triggers

It's not possible, logically, the rows always change, you always have portion of them so if I have lets say rows 480 to 580 out of 1000 sorting will do what? it doesn't make sense.

Will check the refresh thing.

@shlomiassaf invoking refresh still doesn't trigger the handler, updated the stackblitz
https://stackblitz.com/edit/pebula-ngrid-starter-vcrf9e

Fix will be added to next release...