Not exactly sure what you want to achieve but maybe this helps.
If you have 2 entities: Category and Product, make sure the product refers to the category. In other words make sure the Product page has a reference selector to select the category.
Create a page with a datagrid of the categories. Next to the grid add a dataview with the source being listen to grid. MAke sure this listens to the datagrid of categories. In the dataview add a datagrid that shows products over the association with the category. Now when selecting a category the dataview is populated with the category and shows a grid of all the products that are associated with the selected category.
For more information of listen to grid see: https://docs.mendix.com/refguide/listen-to-grid-source