Try ERPNext Buy Support Partners Foundation

Custom Query Report - Get All Selected Rows

Hi,

i had custom script report and i am trying to get all selected rows, I had this part of code, which is partially working:

$('.dt-scrollable').find(":input[type=checkbox]").each((idx, row) => {
    	if(row.checked){
    		console.log(row.closest(".dt-cell"));
    		console.log($(row.closest(".dt-cell")).data("row-index"));
    	}
    });

But, this code will return only rendered rows. And when i click mark all rows, i will get only 25 rendered. Is there way how to return all of them?

In:

 frappe.query_report.data

There are all of them, but i don’t know which one is selected.
Thanks

If what you need is selected rows in a table field. I’m not in front of the computer but I know there’s a method to get the selected rows as follows.

frm.get_selected().table_field_name;

If used from the browser console replace frm to cur_frm

EDIT: Corrected the method.

Hi, thanks for your answer. But i thing that, this is working only for Child tables.

But i found in report_view.js this:

const selected_items = this.get_checked_items(true);

But when i call it in query report onload

frappe.query_report.page.add_inner_button(__("Get Selected"), function() {
   //this.get_checked_items(true);
   //query_report.get_checked_items(true);
   frappe.query_report.get_checked_items(true);			
});

I am getting:

get_checked_items is not a function

Can somebody help with that ? :slight_smile:

@rmehta Can you help with that? Or somebody from your team?

I undestand that you are not glad that i marked you. But i believe there is some nice way how to do that, and answer can help also to others.

I want only know if there is some function or example in code for this purpose. If not i will try to write some.

Thanks for your time.