Loop through DataSource or get (java)Collection out of DataSource

Hi,

I have only one Entity on my Cuba Project and I want to show it in my very own way ( in some way that has nothing to do with the current Table componentes and stuff) so if I create a new “Entity browser and editor screens” all the fields in my table will be filled with the proper DataSource ( based on an Entity with 3 string fields ), how can I get all the items from that DataSource? How can I turn that DataSource into a java Collection so that I can get every single item from there ?

Thank you all by advance,
Jordi.

Hello, @jordi.gisbert.ponsoda!

Just inject the datasource to controller class, like

@Inject
protected CollectionDatasource<MyEntity, UUID> myEntitiesDs;

Use the method myEntitiesDs.getItems() to get collection of elements.

https://doc.cuba-platform.com/manual-6.8/manual.html#datasources