How to add click event in script report column using formatter?

How to add click event in script report column using formatter ?.

link click already to add normal click.

i tried to add columnDef.df.onclick instead of columnDef.df.link_onclick ,it is not working

can you post your js code?

"formatter": function(row, cell, value, columnDef, dataContext, default_formatter) {
		if (columnDef.df.fieldname=="account") {
			value = dataContext.account_name;

			columnDef.df.onclick =
				"erpnext.financial_statements.open_general_ledger(" + JSON.stringify(dataContext) + ")";
			columnDef.df.is_tree = true;

Are you trying to change financial_statements.js or doing it in some custom script report? Is your field name also account?

field name is account.copy same code in my custom app

I can try it out if you include your complete js file.

All code is same as financial statement.js


columnDef.df.onclick =“erpnext.financial_statements.open_general_ledger(” + JSON.stringify(dataContext) + “)”;

it is i added for click event ,but it is not working

all other code is same as financial statements.js

The code should be
columnDef.df.link_onclick =
columnDef.df.onclick =

Also the field type should be defined as Link to accept to run the onclick trigger.

columnDef.df.link_onclick = is working fine.but it work only if there is data in columns.if there is no data,we need click on blank column and pop up field to update data

is there any way(any event on mouse click) in script report to pop up field when there is no data in column

Yes it doen’t
You have to put something like underscore _ or * or - when the field is empty.
Also you can use the below code:
var $value = $(value).css({“display”:“block”,“width”:“100%”});
to make the whole cell clickable not only the text inside the cell.