如果用户在菜单上快速单击,则不会再显示Durandal视图

时间:2014-01-16 15:46:46

标签: durandal durandal-2.0

我使用Durandal 2.0&在我的SPA中微风。

我的司机(司机)有一个侧边栏菜单,用户可以点击子菜单(Récents,Disponibles,Indisponibles)以使用不同的参数调用我的视图。这将用koGrid填充数据。数据在激活调用中获取,koGrid的绑定在compositionComplete中完成。

enter image description here

大部分时间一切顺利。当我在子菜单上快速点击(调用相同的视图)时出现问题。示例:我点击'Récents'并立即(无需等待视图显示)我点击'Disponibles'。

我对激活有以下内容:

var activate = function (filterParam) {
    filter(filterParam);
    pagedDataSource.getDataFunction = getData;
    pagedDataSource.getPredicatesFunction = getPredicates;
    return pagedDataSource.reload();
};

我对compositionComplete有以下代码:

var compositionComplete = function (view) {
    bindEventToList(view, '.kgCellText', gotoDetails);
    $('#mySearchGrid').attr('data-bind', 'koGrid: gridOptions');
    ko.applyBindings(vm, document.getElementById('mySearchGrid'));
};

当我追踪活动时,我注意到如果用户在子菜单上快速点击,则激活没有时间完成并再次被调用(对于用户的第二次点击)并且compositionComplete不会执行。然后,在视觉上没有更多的事情发生。它似乎被阻止了。

任何想法如何防止这个问题?

感谢。

1 个答案:

答案 0 :(得分:0)

迁移到最新的Durandal版本2.0.1解决了这个问题。