我是jayData的新手,我試圖過濾一個實體集。過濾器需要執行超出我在樣本中看到的複雜評估。jayData複雜過濾器評估
這裏是什麼,我試圖完成一個工作示例(ListView的行不,是隻是爲了展示一下我打算用數據做):
function() {
var weekday = moment().isoWeekday()-1;
console.log(weekday);
var de = leagueDB.DailyEvents.toArray(function (events) {
console.log(events);
var filtered = [];
for (var e = 0; e < events.length;e++) {
console.log(events[e]);
console.log(events[e].RecurrenceRule);
var rule = RRule.fromString(events[e].RecurrenceRule);
var ruleOptions = rule.options.byweekday;
var isDay = ruleOptions.indexOf(weekday);
console.log(ruleOptions, isDay);
if(isDay =! -1)
{
filtered.push(events[e]);
}
}
$("#listView").kendoListView({dataSource:filtered});
});
基本上它只是評估經常性規則字符串以查看當天是否符合該條件,如果是的話將該事件添加到列表中以供查看。
但是,當我嘗試這樣做它吹起來:
eventListLocal:leagueDB.DailyEvents.filter(function(e){
console.log("The Weekday is:"+viewModel.weekday);
console.log(e);
console.log("The recurrence rule is:"+e.RecurrenceRule);
var rruleOptions = viewModel.rruleOptions(e.RecurrenceRule);
if (rruleOptions !== -1) {
return true;
}
}).asKendoDataSource()
所產生的錯誤是: 異常:無法解析類型:未定義
的事情是它似乎發生在「e」和控制檯日誌中,像事件沒有被傳入。但是,我沒有看到一個列表。總之,我對於發生了什麼感到困惑。
任何幫助,將不勝感激。 謝謝,