Filter child table

hello, I’m having trouble filtering child tables, where I have factor and parameter fields
like the picture below:



have you found the solution? if yes please describe i also facing the issue.

1 Like

Use Something Like this

frappe.ui.form.on("Quotation", "refresh", function(frm) {
    frm.fields_dict['items'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
        var child = locals[cdt][cdn];
        //console.log(child);
        return {    
            filters:[
                ['Item', 'item_group', '=', child.item_group]
            ]
        };
    };
});
3 Likes

thankyou, very helpful for me

The stander way to do it is using set_query

frm.set_query("items","item_code", function(){
       return {
              filters:[
                ['Item', 'item_group', '=', child.item_group]
            ]
       }
})

This also handle empty filter value