gpt4 book ai didi

javascript - 应用上下文时出错 TypeError : Cannot read property 'getReferences' of null Error

转载 作者:行者123 更新时间:2023-12-02 09:00:26 28 4
gpt4 key购买 nike

应用程序抛出空错误,尝试了一些方法但没有运气,看起来很简单,但我一生都无法弄清楚,不确定我错过了什么。希望有人能看到这个问题。

** 日志 **

RouteToMarketSearch.RouteToMarketSearchSnippet.referenceSetDisplay2: Error while applying context Error: RouteToMarketSearch.RouteToMarketSearchSnippet.referenceSetDisplay2: Error while applying context TypeError: Cannot read property 'getReferences' of null Error: RouteToMarketSearch.RouteToMarketSearchSnippet.referenceSetDisplay2: Error while applying context Error: RouteToMarketSearch.RouteToMarketSearchSnippet.referenceSetDisplay2: Error while applying context TypeError: Cannot read property 'getReferences' of null

声明变量

_handles: null,
_contextObj: null,
_reference : null,
_entity : null,
_intersectReference : null,
_intersectEntity : null,

** 代码 **

_updateRendering: function (callback) {
logger.debug(this.id + "._updateRendering");
var self = this;
if(this.rsdListContainer){
data.get({
guids: this._contextObj.getReferences(this._reference),
callback: function(objs){
if(self.rsdListContainer){
var intersectGuids = [];
if(self._intersectReference){
intersectGuids = self._contextObj.getReferences(self._intersectReference);
}

var dataArray = objs.map(function(o){
var data = {};
data.guid = o.getGuid();
data.caption = o.get(self.displayAttribute);
if( intersectGuids && intersectGuids.indexOf(o.getGuid()) > -1){
data.elementClass = self.intersetResultClass;
}
if(self.sortAttribute){
data.sortIndex = parseInt(o.get(self.sortAttribute));
}

return data;
});

if(self.sortAttribute){
dataArray.sort(function(a,b){
return a.sortIndex - b.sortIndex;
});
}

dojoConstruct.empty(self.rsdListContainer);

最佳答案

如果您使用 null 值声明 _contextObj,则当您尝试执行 this._contextObj.getReferences 时,会引发该错误。没有空值的内部实现,您需要声明它或限制其访问

关于javascript - 应用上下文时出错 TypeError : Cannot read property 'getReferences' of null Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60210752/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com