-1

I am creating a generic grid component that would show data for schema that I don't know anything about at compile time. Data updates (and row additions) come as sparse arrays (row4,col7='abc'; row8,col2=456). I am generating ColDef set at runtime.

I believe I understand how to grab a row by key and set data on it using the columnApi. But how do I create a new row without knowing its type? A good analogy is creating a row from a dictionary of column name to value. I am also a bit new to TypeScript and JavaScript... Maybe I am missing something obvious because of this...

Thank you.

AlexeiOst
  • 574
  • 4
  • 13
  • why -1? Just curious. Does not make mach difference to me... What is it, "hit and run", or beneath you to explain? Why do you come here then? – AlexeiOst May 20 '19 at 13:13

1 Answers1

0

After some more searching for more specific terms:

let anObj ={};
anObj['dynProp'] = 'my dynamic value';
expect(anObj.dynProp).toBe('my dynamic value');//this passes; using Karma

Taken from below, answered by Angelo R.; the accepted answer is about slightly different... How do I dynamically assign properties to an object in TypeScript?

AlexeiOst
  • 574
  • 4
  • 13