material icon indicating copy to clipboard operation
material copied to clipboard

md-virtual-repeat can not handle data set change on `md-on-demand` mode.

Open cnjsstong opened this issue 11 years ago • 7 comments

In 0.11.0-rc1, the new "on demand" mode works great for non-changing dynamic loading.

However, if something makes the original data set to change, like a filter applied, there is currently no way to notify the directive that the data has changed and it should refresh the whole list.

Is an Android style notifyDataSetChanged() possible?

cnjsstong avatar Sep 01 '15 20:09 cnjsstong

+1

ghost avatar Sep 03 '15 18:09 ghost

I've had some results by rebuilding the page array after filters have changed. in most cases this seems to update the list.

digital-synapse avatar Sep 03 '15 18:09 digital-synapse

In my case there's a dataset that gets items prepended and removed at a relatively fast pace. In my case a 'pagination' with a linked-list-like behavior rather than index makes more sense. Maybe there could be some alternative virtual-repeat model that looks like:

{
  getItemAfter(item, offset), // call with null to get the first item
  getItemBefore(item, offset) // call with null to get the last item
}

Janpot avatar Oct 14 '15 09:10 Janpot

+1

TwDrake avatar Oct 28 '15 17:10 TwDrake

Mirroring the comment by @digital-synapse, I verified that you can trigger an update by replacing the model reference. I also tested that changing the values returned from getItemAtIndex also results in appropriate updates to the displayed data.

Can you provide a test case of what isn't working? Thanks.

kseamon avatar Nov 09 '15 19:11 kseamon

+1

kiro64 avatar Nov 21 '15 08:11 kiro64

+1

HipsterZipster avatar Dec 14 '15 20:12 HipsterZipster