应用上下文typeerror时出错:无法读取null错误的属性“getreferences”

vql8enpb  于 2021-07-12  发布在  Java
关注(0)|答案(1)|浏览(313)

应用程序抛出空错误,尝试了几件事却没有运气,看似简单的事情却无法为我的生活弄清楚,不确定我错过了什么。希望有人能看到问题所在。

日志

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);
8nuwlpux

8nuwlpux1#

如果你要申报 _contextObj 当您尝试执行 this._contextObj.getReferences 抛出那个错误。没有空值的内部实现,您需要声明它或对其访问设置条件

相关问题