Listview select limit

Hi
I am writing some custom coding for listview.

It seems that, no matter how many items I actually select, my code…

frappe.listview_settings['Task'] = {
    onload: function(listview) {
        listview.page.add_inner_button(__('Add Expected Times'), function() {
            let selected_items = listview.get_checked_items();
            if (selected_items.length >= 1) {
               
                let total_expected_time = 0;
                debugger;

                frappe.call({
                    method: "frappe.client.get_list",
                    args: {
                        doctype: "Task",
                        filters: {
                            name: ["in", selected_items.map(item => item.name)]
                        },
                        fields: ["expected_time"]
                    },
                    callback: function(response) {
                        let tasks = response.message;
                        debugger;
 
                        tasks.forEach(task => {
                            debugger;
                            if (task.expected_time) {
                                time = task.expected_time;
                                total_expected_time += time ; // Ensure that undefined values are treated as 0
                                debugger;
                            }
                        });

                        frappe.show_alert({
                            message: `Total Expected Time: ${total_expected_time} hours`,
                            indicator: "green"
                        });
                    }
                });                
                
            } else {
                frappe.show_alert({
                    message: "Please select at least one Task.",
                    indicator: "orange"
                });
            }
        });
    }
};
                
                

Only allows a max of 20 items ??
Is there a way to increase this ?

1 Like

I have been digging a bit further … this seems to be a limitation of
frappe.client.get_list ???

I think I found the answer … “limit_page_length”

I modified my query…

( just a snip )

                frappe.call({
                    method: "frappe.client.get_list",
                    args: {
                        doctype: "Task",
                        filters: {
                            name: ["in", selected_items.map(item => item.name)]
                        },
                        fields: ["expected_time"],
                        limit_page_length: selected_items.length
                    },

Seems to be working now.

2 Likes