Can we add new attribute dynamically to entity?

1
Can we add new attribute dynamically to entity? By any means either by Java actions use case: i) User can upload a excel file, UI should dynamically render grid based on that data and also allow them to edit. ii) Dynamically generate grid based on the json input, We have a grid in which need to show the dynamic columns based on json input, values are grouped under 'data' key,    a) data : [{'abc':'11', 'abd:'12'},{'abc':'12', 'abd:'13'}] , should create column 'abc', 'abd'  in data grid   b) data : [{'aa':'11', 'bb:'12'},{'aa':'12', 'bb:'13'}] , should create column 'aa', 'bb' Any suggestion? Thanks, Mani
asked
2 answers
1

No, that is not possible. To add columns to your tables you need to redeploy your model.

answered
1

Manivannan,

I have not tested this, but here is an idea for how you could do this without using the SDK (i.e. this is a 'Modeler Only' solution).

Start with a domain model like this:

This domain model will enable you to import json with an unlimited (in theory) number of columns and rows.  I think importing the json into this structure is pretty straightforward, so I haven't put any work into that.

Then, for a page, you could have a number of ListViews, like this:

If the containers on this page (with column title and column values) are responsive and of limited size they can be styled so that they float onto a single line, if there is enough screen space.  In this way, you can present a grid like user interface.

As I said, I haven't tested this out, but think it should be workable.

One note:  I have used a structure like this to make an editable page to mimic a spreadsheet.  With a large number of rows providing data entry capabilities, browser performance was poor.  There were simply too many text boxes with on change microflows.  This was before the advent of nanoflows, so it could be different with current Mendix versions.

answered