How to apply filter on button click

hi team,
i have create one page in that page i have add button based on type supoose
i have type xyz and i cretae xyz button and in that button href link will be added of another page .when i clcik on xyz button then nex page open .in that page some filteration are used .based one button selection automatically apply filter on next page of button click

1 st click on xyz type
2 nd page type =xyz filters applied

how this one achecived in jinja beacuse i am using jinja timeplating to add the link of another page

You may need to pass parameters in the URL to make this happen

Hi,
For this case you need to apply a method called frappe.set_route()
the below code might help you out of this:

frappe.ui.form.on('Custom Page', {
    'xyz_button': function(frm) {
        var type = 'xyz'; // get the type of button clicked
        var filters = {
            'doctype': 'Some Doctype',
            'filters': [
                ['Some Doctype', 'type', '=', type]
            ]
        };
        var url = '/desk#List/' + encodeURIComponent(JSON.stringify(filters)); // construct the URL with the required filters
        frappe.set_route(url); // redirect to the

Thank you.

i pass the query paramter but not working

can we use this in jinja??
because i am giving next page link in jinja throgh href .

Yes, this approach might work.

Thank you.