Here is the code: /
How to filter personRoles
by role
property?
Each list must have only own role
items.
Thanks.
Here is the code: http://jsfiddle.net/Gr3fT/1/
How to filter personRoles
by role
property?
Each list must have only own role
items.
Thanks.
Share Improve this question asked Nov 10, 2011 at 10:07 Lari13Lari13 1,87010 gold badges28 silver badges56 bronze badges2 Answers
Reset to default 15This function works (based on http://knockoutjs.com/examples/animatedTransitions.html :)
get: function(role)
{
return ko.dependentObservable(function ()
{
return ko.utils.arrayFilter(this.personRoles(), function(item)
{
return item.id == role;
});
}, viewModel);
}
It might help you.
This example basically used for filter observable array by passing input parameters at the key up event.
https://stackoverflow.com/a/25241564/3929314