I have an external file that has a collection of data:
U_13_HTS=[
["13 HTS","Radford","A-000001","1230000010","1909","Baseline","Yes","Yes","2019"],
["13 HTS","Radford","A-000002","1230000011","1909","Baseline","Yes","Yes","2019"]
]
U_215_GP=[
["215 GP","Sacramento","A-000005","1230000077","1909","Baseline","Yes","Yes","2019"],
["215 GP","Sacramento","A-000006","1230000078","1909","Baseline","Yes","Yes","2019"],
["215 GP","Sacramento","A-000007","1230000079","1909","Baseline","Yes","Yes","2019"]
]
…
I have a tree with a list of items that are array names in the external file and I collect them from the tree by using:
str = myTree.getAllChecked();
Result is a coma delimited string - example : U_13_HTS,U_215_GP
I am trying to simulate async database calls without having a database…I would like to use the checked item string and map to the array collections in the external javascript file (See above array examples)
The following code works but it is hardcoded…how do I dynamically allow the .concat to accept the tree array that contains the array names that store the data need3ed to populate the grid?
Code:
U_13_HTS=[
["13 HTS","Radford","A-000001","1230000010","1909","Baseline","Yes","Yes","2019"],
["13 HTS","Radford","A-000002","1230000011","1909","Baseline","Yes","Yes","2019"]
]
U_215_GP=[
["215 GP","Sacramento","A-000005","1230000077","1909","Baseline","Yes","Yes","2019"],
["215 GP","Sacramento","A-000006","1230000078","1909","Baseline","Yes","Yes","2019"],
["215 GP","Sacramento","A-000007","1230000079","1909","Baseline","Yes","Yes","2019"]
]
str = myTree.getAllChecked();
arr = str.split(",");
merged = [].concat.apply([], [U_13_HTS,U_215_GP]);
myGrid_Win_01.parse(merged,"jsarray");
- Edited: static example
Thanks