Load table with generic listing

a given user interface, when opened, executes a service, from cuba, it will read data from the database and return to the interface a listing with several rows and columns.

the problem is that this listing would be a generic list, that is, it is not a database table and could be used in more than one place.

assemble the listing and load the data, it’s fine.

question, how to load interface table with this generic class?

Could anyone tell me what would be the best way?

Hi,
You need to:

  1. create a non-persistent entity that represents the data structure to be shown in the interface table.
  2. implement the logic of data loading in a middleware service (e.g. with DataManager, or some business logic)
  3. In the screen, create a collection container that points to that nonpersistent entity. Add a table bound to a collection container.
  4. Implement a load delegate for the collection loader that fills the list of entities. See samples here: Binding components to nonpersisted entities - #3 by tsarev
    Refresh Datagrid from Non-Persisted Entity

Example of a non-persistent entity is here: https://github.com/cuba-platform/sample-timesheets/blob/master/modules/global/src/com/haulmont/timesheets/entity/WeeklyReportEntry.java

1 Like

is already in operation.

Thanks a lot for the help