corp.customControls.treeView.js
- Last UpdatedMar 12, 2021
- 1 minute read
(function ()
{
//// Defining Namespaces
window.corp = window.corp || {};
corp.customControls = corp.customControls || {};
corp.customControls.treeView = corp.customControls.treeView || {};
corp.customControls.treeView = (function ()
{
//// Initializes Tree View
function initializeTreeView(treeViewControl)
{
var lookupName = treeViewControl.lookupName,
parameterCollection = treeViewControl.parameterCollection;
if (lookupName === "")
{
return;
}
//////// Subscribes to parameter control
//////// When value of the parameter control changes, the function passed as the 3rd parameter is called
if (!SFU.isUndefined(parameterCollection) && parameterCollection.length > 0)
{
SFU.subscribeToControlParameters(treeViewControl, parameterCollection, function () { getTreeViewData(treeViewControl); });
}
//////// Calls the Lookup for getting the Schema and Data
getTreeViewData(treeViewControl);
}
//// Calls the Lookup for getting the Schema and Data
function getTreeViewData(treeViewControl)
{
var lookupName = treeViewControl.lookupName,
parameterCollection = SFU.getLookupParameterValues(treeViewControl, treeViewControl.parameterCollection);
var lookupData = SFU.getLookupSchemaAndData(lookupName, parameterCollection, false);
if (!SFU.isUndefined(lookupData))
{
treeViewControl._dataTextField(lookupData.DisplayColumn);
treeViewControl._source(lookupData.Data);
}
}
//// Public methods
return {
initializeTreeView: initializeTreeView,
getTreeViewData: getTreeViewData
};
})();
})();