Javascript 应用上下文TypeError时出错:无法读取null错误的属性“getReferences”
应用程序抛出空错误,尝试了一些事情,但没有运气,似乎很简单,但无法为我的生活,不知道我错过了什么。希望有人能看到这个问题 **日志**Javascript 应用上下文TypeError时出错:无法读取null错误的属性“getReferences”,javascript,java,null,widget,mendix,Javascript,Java,Null,Widget,Mendix,应用程序抛出空错误,尝试了一些事情,但没有运气,似乎很简单,但无法为我的生活,不知道我错过了什么。希望有人能看到这个问题 **日志** RouteToMarketSearch.RouteToMarketSearchSnippet.referenceSetDisplay2: Error while applying context Error: RouteToMarketSearch.RouteToMarketSearchSnippet.referenceSetDisplay2: Error wh
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,当您尝试执行此操作时。_contextObj.getReferences将抛出该错误。没有空值的内部实现,您需要声明它或调节它的访问权限我尝试初始化它,但不起作用,我将尝试调节它的访问权限。初始化后尝试使用console.log并检查getReferences函数是否存在我认为我可能声明的变量错误,这是正确的方法吗;?如果this.rsdListContainer&&this.\u contextObj{应该能做到这一点。@EdLucas你真是个天才。'FULL STOP'。我试图调整它的访问权限,但出现了错误的部分。