question

Upvotes
Accepted
76 15 21 29

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?

eikoneikon-app-studio
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
Accepted
257 1 3 5

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea