Filter in Dialog: List DocTypes with a child table that comprises a specific Link

Hi all,

I have a doctype Doc1 with a child table Table1 and a Link to DocType Doc2 in each child table row.

In a frappe.ui.dialog I have a Link field to show Doc1 documents. This works, but all documents of doctype Doc1 are shown when kliking in that field.

Now want to show only those documents in the link field of type Doc1 that have a link to a specific document of type Doc2.

How would I set the filter for the ui dialog? I found information on how to set the filters for a frm object. But not for the ui.dialog.