2013-10-18 59 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') 

我能夠把這些原型,使其在濾波投影工作,分類預測,分組預測等?

回答

0

方法如createdFilterdcreateSorted等,創建不同的對象姓名錶明, 所以你需要延長的,在你的情況將是:

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