Lar*_*i13 11 javascript knockout.js
这是代码:http://jsfiddle.net/Gr3fT/1/
如何personRoles按role属性过滤?
每个列表必须只有自己的role项目.
谢谢.
Lar*_*i13 15
此功能有效(基于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);
}
Run Code Online (Sandbox Code Playgroud)