Kendo-从localStorage读取时级联错误

时间:2019-06-18 22:11:56

标签: jquery kendo-ui

我的剑道dropDownList具有以下级联事件:

cascade: function (e) {
    if (!_viewModel) {
        return;
    }

    if (e.sender.value() == _.find(_taskTypeData, function (type) { return type.TaskTypeSlug == "delete_request"; }).TaskTypeId) {
        _viewModel.set("AssignedToTypeId", _.find(_taskAssignmentTypesData, function (type) { return type.TaskAssignmentTypeSlug == "centre" }).TaskAssignmentTypeId);
        _viewModel.set("CentreId", _.find(_centresData, function (centre) { return centre.CentreSlug == "national" }).CentreId);
        return;
    }

    _viewModel.set("AssignedToTypeId", _.find(_taskAssignmentTypesData, function (type) { return type.TaskAssignmentTypeSlug == "user" }).TaskAssignmentTypeId);
    _viewModel.set("CentreId", localStorage.CentreId);
}

实施此操作时,出现竞争情况并显示以下错误消息:

  

无法读取未定义TypeError的属性'removeClass':无法读取   未定义的属性“ removeClass”

我能够找到错误发生在最后一行代码的位置。奇怪的是,如果我用一个ID代替值localStorage.CentreId来硬编码ID,那么竞争条件就消失了。

将我的可观察对象中的值设置为存储在localStorage中的值时,会导致竞争情况吗?

0 个答案:

没有答案