Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Add Checkbox in Query / Script report


i want to add checkbox in query report and want to perform some actions on selected rows like delete, submit etc.

This is what i’ve tried but checkboxes are not clickable.

    0 as ":Check:20",
    name as "Name:Link/Sales Invoice:200"

`tabSales Invoice`;

Maybe its work on custom report

Yes its working on customs reports but i want it to work on query and script reports.

Yes it is.

I’ve successfully got check boxes on report but now unable to access selected records,

i need to get list of selected invoices number when i click on my custom button.

here is what i’ve tried.

frappe.query_reports["Testing"] = {
    onload: function(report) {"Test"), function() {
			let selected_rows = cur_frm.doc["item"].grid.get_selected();

    get_datatable_options(options) {
        return Object.assign(options, {
            checkboxColumn: true

but got this error:

VM1924:5 Uncaught TypeError: Cannot read property 'doc' of null
    at <anonymous>:5:32
    at HTMLButtonElement.i (page.js:452)
    at HTMLButtonElement.dispatch (jquery.min.js:3)
    at HTMLButtonElement.r.handle (jquery.min.js:3)

You can get selected rows of report having checkbox as below:

	onload: function() {"Get Selected"), function() {
			var selected_rows = [];
			$('.dt-scrollable').find(":input[type=checkbox]").each((idx, row) => {
					console.log("*** selected row id : " + idx);
1 Like

Thank you so much @sanjay, it works. :+1:

I am trying like this, but older version like 6.xx maybe doesn’t support onload inside query_report. Can you please tell me any alternate way.

Can you please explain how did you get the checkboxes?

Found it. Added below function to frappe.query_report["<report-name>"] object

get_datatable_options(options) {
		return Object.assign(options, {
			checkboxColumn: true,

Can something similar be done in html? I want to print an image, if the checkbox is selected