应用程序抛出空错误,尝试了一些尝试,但是没有运气,似乎很简单,但却无法弄清我的一生,不确定我缺少什么。希望有人能看到问题。
**登录**
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);
最佳答案
如果使用空值声明_contextObj
,则在尝试执行this._contextObj.getReferences
时会抛出该错误。没有内部实现的空值,您需要声明它或限制其访问
关于javascript - 应用上下文TypeError时出错:无法读取null的属性'getReferences',我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/60210752/