Using the SortableTableBuilder for rendering Bootstrap tables

As of EntityModule 2.0.0 the default list views of the entity admin interfaces are being generated using a SortableTableBuilder.  You can easily use this functionality yourself to generate bootstrap compliant tables of any registered entity.  You can even use it for any custom class, but then you might have to add some more configuration.  SortableTableBuilder is a prototype scoped bean but the easiest point of access is going through the EntityViewElementBuilderHelper.  

The SortableTableBuilder builds a ViewElement that could then be rendered using thymeleaf with <across:view element="${myElement}" />.

Example of a simple table for a known entity
@Autowired
private EntityViewElementBuilderHelper builderHelper; 
 
Page<Partner> partners = new PageImpl<>( allPartners );
 
return builderHelper.createSortableTableBuilder( Partner.class )
                    .items( partners )              // rows in the table
                    .properties( "name", "url" )    // columns - render all default properties of Partner
                    .build( builderContext );       // build the actual TableViewElement (and surrounding containers)

If the javascript and css of EntityModule are included, default paging and sorting support can easily be enabled.

A good demonstration of SortableTableBuilder features can be found in the EntityModuleTestApplication inside the source project of EntityModule.  To set up the demo pages in a project of your own, we have crated a Bitbucket snippet containing all necessary source code.  Code should well-documented and easy enough to follow if you have basic experience with Across and EntityModule.  Requirements for your application are AdminWebModule and EntityModule.

Snippet with demo pages source

https://bitbucket.org/snippets/beforeach/ox4pe/sortabletablebuilder-demo-functionality