How should I use a listGrid with a collection of my favorites records from a specific document?

I need to show a collection using listgrid and plan to have the filtering mechanism on that? how to do this?

>Solution :

There is no filtering in a data grid, so you are right, you’ll need a list grid.

ListGrids are powered by org.skyve.metadata.view.model.list.ListModel s.
There are some implementations built-in such as org.skyve.metadata.view.model.list.DocumentQueryListModel that can generate the data required by building a DocumentQuery from a metadata query.

There is a org.skyve.metadata.view.model.list.ReferenceListModel that you can extend to give the driving document and reference binding.
The referenceBinding is the binding to your collection (or association) with respect to the document backing the view that the list grid is contained in.

Take a look at modules.admin.UserDashboard.models.FavouritesModel.
You can see that the admin.UserDashboard.favourites collection is a collection of Generic and and the FavouritesModel has a driving document of "Generic" and a referenceBinding of "favourites".

Also, the model’s column definitions use binding expressions relating to the driving document of the model, in this case admin.Generic.
This is congruent with meta data query columns.

Leave a Reply