Workspace Cache(?) Problem

I explained my problem with images.

In short, custom js scripts in reports or documents remain active in the workspace when you click the back button (or “e” logo). but when i refresh the page it is fixed. how can i fix this?



Hi @gelveri,

Please share your code.

Hii @NCP

my js code in the report;

$(".custom-actions.hidden-xs.hidden-md").hide();
$(".menu-btn-group").hide();



frappe.query_reports["Status of My Hourly Leaves Earned"] = {
    "filters": [

    ],
    "onload": function(report) {
        $(document).ready(function() {
            // Add content after the report title
            var report_head = $(".page-head-content");
            var info = $("<p style='color:#169754;'> <b>In accordance with the Human Resources Regulation, Leisure Leaves can be used 1 month after the leave is earned. </b></p>");
            report_head.after(info);
        });
        frappe.after_ajax(function() {
            $('.col-md-12 span').parent().parent().parent().hide();
        });
        setTimeout(function() {
            $('.report-footer.text-muted').hide();
        }, 1000);

    },




};

Hmm, you are right :sweat_smile: @gelveri,

Please try it.

	"onload": function (report) {
		// Check if the content is already added to avoid duplication
		if (!$(".custom-report-content").length) {
			// Add content after the report title, inside a specific div with class "custom-report-content"
			var report_head = $(".page-head-content");
			var info = $("<div class='custom-report-content'><p style='color:#169754;'><b>In accordance with the Human Resources Regulation, Leisure Leaves can be used 1 month after the leave is earned.</b></p></div>");
			report_head.after(info);
		}

		// Code to hide elements after the report is loaded
		frappe.after_ajax(function () {
			$('.col-md-12 span').parent().parent().parent().hide();
		});

		setTimeout(function () {
			$('.report-footer.text-muted').hide();
		}, 1000);
	},

Then reload and check it.

Thank You!

1 Like

Hi @NCP
sorry bro but unfortunately it didn’t work.

https://streamable.com/hf0lto

Please check the video.

Thank You!

Thanx for support @NCP

But please while your code is active; test this report first and test a different report.

Hmm right @gelveri,

It is a makeshifter script. so I don’t have any idea.

Thanks anyway bro. You are a real man!