What is the best practice to binding components to nonpersisted (in memory) entities? Possibly an ArrayList of the nonpersisted entity and then loading that into DataContainer via a loader. My only requirements is have collection passed to a screen and bind to a component on Init.
Hello @fredzim1
You can install DataLoader
delegate to provide data, for example:
@Inject
private Metadata metadata;
@Install(to = "testEntitiesDl", target = Target.DATA_LOADER)
private List<TestEntity> testEntitiesDlLoadDelegate(LoadContext<TestEntity> loadContext) {
List<TestEntity> entities = new ArrayList<>();
for (int i = 0; i < 10; i++) {
TestEntity entity = metadata.create(TestEntity.class);
entity.setFirstName("First name #" + (i + 1));
entity.setLastName("Last name #" + (i + 1));
entity.setPhone("8 800 555 35 35");
entities.add(entity);
}
return entities;
}
Read our documentation for further information: Data Loaders
Regards,
Daniil
Got it. Thanks.