2013-10-18 2 views
0

WinJS.Binding.List 투영법 (예 : createFiltered)에서 프로토 타입 메서드를 사용하고 싶습니다.WinJS.Binding.List 투영에 대한 프로토 타입

예 :

WinJS.Binding.List.prototype.shoutLength = function() { 
    console.log("MY LENGTH IS " + this.length); 
} 


var list = new WinJS.Binding.List([2,1,3]); 
var filtered = list.createFiltered(function (item) { return item <= 2; }); 

list.length; // outputs 3 
filtered.length; // outputs 2 

list.shoutLength(); // works 
filtered.shoutLength(); // doesn't work (Object doesn't support property or method 'shoutLength') 

내가 예측을 분류, 그래서 필터링 된 예측에서 작동 할 수있는 프로토 타입을 어떻게 적용 할 수있는 등 그룹화 전망? 등 createdFilterd, createSorted

답변

0

방법, 이름대로 될 것 그래서 당신은 당신의 경우에 그를 확장해야합니다, 제안 다른 개체를 만들 :

WinJS.Binding.GroupedSortedListProjection, 
WinJS.Binding.FilteredListProjection, 
WinJS.Binding.SortedListProjection