Uncheck items in List View with Client Script

Gentlemen,
I need to uncheck items in a List View.

From the frappe source I clobbered together this promising code, but I’m stuck because I can’t figure out how to initailize $wrapper the right way:

function set_rows_as_unchecked() {
    alert("set_rows_as_unchecked");
	$results = $wrapper.find('.results');
    this.$checks = this.$result.find(".list-row-checkbox:checked");
    $.each(this.$checks, (i, el) => {
        let docname = $(el).attr("data-name");
        this.$result
            .find(`.list-row-checkbox[data-name='${docname}']`)
            .prop("checked", false);
    });
}

Please assist.

location.reload() resets the checkboxes but also takes me back to the top of the list.
I would like to keep the current state of the list and just clear the checkboxes.

This code actually unchecks all rows, but unfortunately afterwards all calls to get_checked_items() cause an execption:

function uncheck_all() {
	$.each(cur_list.$checks, (i, el) => {
		let docname = $(el).attr("data-name");
		cur_list.$result
			.find(`.list-row-checkbox[data-name='${docname}']`)
			.prop("checked", false);
	});
	cur_list.on_row_checked();

    console.log(get_checked_items()); // Causes an exception now and for all future calls
}