Our users can add other products to a product as associations. For most of our association types it doesn't make sense to show all products in the grid, they should select only products from one family.
The user could filter products by family in the Akeneo GUI, but it would be less work & make our data more consistent if the filter would get selected programmatically.
I would modify the code in Pim/Bundle/EnrichBundle/Resources/views/Association/_associations.html.twig
like this:
var changeAssociation = function (associationId) {
var $idField = $('#pim_product_edit_associations').find('input[type="hidden"][value="' + associationId + '"]');
// 4 is an association example id where only one family should be displayed
if(associationId == 4) {
// TODO: Filter family in the product grid
// mediator.trigger('datagrid:???:' dataGrids.product.name);
}
How can I change the filter of the product grid in Javascript?
Or is there a better way for my goal?