Szymon Rozga
Szymon Rozga

Reputation: 18178

WinJS Binding List live sorting

I am using a WinJS.Binding.List to bind data to a ListView. I would like to use the createSorted method to create a sorted projection on the list. In addition, the data inside the list is live so it will be changing. Obviously the sorted projection will not automatically watch the properties to see if they are changing. I can't find a mechanism that will allow me to invoked a 're-sort'. Does something like that exist?

Upvotes: 2

Views: 768

Answers (2)

Jacob Morrison
Jacob Morrison

Reputation: 648

I believe you will need to call notifyMutated on the list at that item.

http://msdn.microsoft.com/en-us/library/windows/apps/hh700771.aspx

Upvotes: 0

Marcus Ilgner
Marcus Ilgner

Reputation: 7231

The list should automatically re-sort itself if you use the WinJS.Binding.mixin or WinJS.Binding.as on the elements in your list.

This will make them observable by the list and it should not only update any bound properties you reference in your itemTemplate but also re-sort the list when using projections.

http://msdn.microsoft.com/en-us/library/windows/apps/br211859.aspx

Upvotes: 2

Related Questions