Add checks to see if actionManager has been set before using it

Fixes errors in historylog widget
This commit is contained in:
nathangray
2018-05-11 14:33:17 -06:00
parent 8030c477c9
commit 820d269e71

View File

@@ -58,9 +58,12 @@ var et2_dataview_selectionManager = (function(){ "use strict"; return Class.exte
} }
// Use our selection instead of object manager's to handle not-loaded rows // Use our selection instead of object manager's to handle not-loaded rows
if(_actionObjectManager)
{
this._actionObjectManager.getAllSelected = jQuery.proxy( this._actionObjectManager.getAllSelected = jQuery.proxy(
this.getAllSelected, this this.getAllSelected, this
); );
}
// Internal map which contains all curently selected uids and their // Internal map which contains all curently selected uids and their
// state // state
@@ -332,7 +335,10 @@ var et2_dataview_selectionManager = (function(){ "use strict"; return Class.exte
var dummyAOI = this._getDummyAOI(_entry, _tr, _uid, _idx); var dummyAOI = this._getDummyAOI(_entry, _tr, _uid, _idx);
// Create an action object for the tr and connect it to a dummy AOI // Create an action object for the tr and connect it to a dummy AOI
if(this._actionObjectManager)
{
_entry.ao = this._actionObjectManager.addObject(_uid, dummyAOI); _entry.ao = this._actionObjectManager.addObject(_uid, dummyAOI);
}
// Force context (actual widget) in here, it's the last place it's available // Force context (actual widget) in here, it's the last place it's available
_entry.ao._context = this._context; _entry.ao._context = this._context;
@@ -419,7 +425,7 @@ var et2_dataview_selectionManager = (function(){ "use strict"; return Class.exte
// Attach ao if not there, happens for rows loaded for selection, but // Attach ao if not there, happens for rows loaded for selection, but
// not displayed yet // not displayed yet
if(!_entry.ao && _entry.uid) if(!_entry.ao && _entry.uid && this._actionObjectManager)
{ {
var _links = []; var _links = [];
for (var key in this._registeredRows) for (var key in this._registeredRows)
@@ -430,9 +436,12 @@ var et2_dataview_selectionManager = (function(){ "use strict"; return Class.exte
break; break;
} }
} }
if(_links)
{
this._attachActionObjectInterface(_entry, null, _entry.uid); this._attachActionObjectInterface(_entry, null, _entry.uid);
this._attachActionObject(_entry, null, _entry.uid, _links, _entry.idx); this._attachActionObject(_entry, null, _entry.uid, _links, _entry.idx);
} }
}
// Update the state if it has changed // Update the state if it has changed
if ((_entry.aoi && _entry.aoi.getState() !== _state) || _entry.state != _state) if ((_entry.aoi && _entry.aoi.getState() !== _state) || _entry.state != _state)