Hey thanks for the help!
I’m sending an AJAX request to the server for 2 things:
An array of strings that represent the Column Headers
Example:
colHeaders = [“Sample ID” , “Sample Type” , “Project Name” … ]
And an array of key-value pairs for JSON:
Example:
{
[ “SampleID” : “1131893” , “Sample Type” : “Clinical” , “Project Name” : “Test Project” ] ,
[ “SampleID” : “1131894” , “Sample Type” : “Clinical” , “Project Name” : “Test Project” ] ,
[ “SampleID” : “1131893” , “Sample Type” : “Clinical” , “Project Name” : “Test Project” ] ,
}
Currently it’s populating the column headers properly and reading all the values into the spreadsheet properly. The problem is that the values and the headers aren’t aligned, so project name will be under sampleID and so on. I have a feeling that I can make sure they’re in the correct order by making sure the colHeaders and Values are in the same order, but that seems like it could lead to potential bugs down the line. I’d like to explicitly assign the value to be in the column where the key matches the column header.
I’m also writing the server methods that returns this data, so I can modify things on that end and change up the data being pulled from the database if needed. And I need to also model whether or not a column is editable and if the column is populated with drop down menus. So the column header structure might turn into something like this:
colHeaders = { “SampleID” : [ “Read Only” ] , “Sample Type” : [ “Clinical” , “Research” , “Biodefense” ] , “Project Name” : [] }
(Where the null values mean normal editable columns, “Read Only” means non-editable, and a list of Strings means “Drop down menu with these options”)
I need to be able to model different spreadsheet styles for different projects depending on the user. So I can’t just hard code all of this in.