How do you reset emerald-grid?

I have code which works fine:

            myGrid.config = {
columnReorder: false,
rowHighlight: true,
rowSelection: true,
columns: myColumns,
dataModel: {
fields: fields,
format: 'array',
data: myData
}
};

But if I attempt to configure the grid later (to add an additional column) it doesn't work. (In fact, if I just run this code snippet above twice in succession, i.e. without even altering the inputs, the grid appears blank).

I have an ugly workaround which is to reset the innerHTML of a <div> containing my grid like so...

document.getElementById("div_" + tName).innerHTML = '<emerald-grid id="' + tName + '" height="192px"></emerald-grid>';

...but surely there must be a better way?

Best Answer

  • Hi Tristan,

    You can modify the grid (like adding/removing columns, manipulate its data, ...) using the grid api without re-creating the grid. You can check out the samples in Eikon Web UI side (cpurl://apps.cp./apps/eikonwebui) and go to Eikon Components -> TR-Grid -> Composite Grid