Created
December 6, 2017 15:29
-
-
Save codenamejason/15cdb8c0014e8718448e422c4d5f436f to your computer and use it in GitHub Desktop.
Get Matching Item From Selectables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetMatchingItemFromSelectables(item, selectablesList) { | |
var chosenIndex = -1; | |
if (item !== undefined && item !== null) { | |
if (item.Key !== undefined) {//this section is deprecated, old way of doing selectables | |
for (var t = 0; t < selectablesList.length; t++) { | |
if (selectablesList[t].Key === item.Key) { | |
return selectablesList[t]; | |
} | |
} | |
}//--end of deprecated section | |
else { | |
if (!item.id) { | |
return item; | |
} | |
for (var t = 0; t < selectablesList().length; t++) { | |
if (selectablesList()[t].id() === item.id()) { | |
return selectablesList()[t]; | |
} | |
} | |
return item; | |
} | |
} | |
return { "Key": "", "Value": -1 }; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment