Skip to content

Commit

Permalink
fix: shift-select checkboxes ranges (#19367) (#19368)
Browse files Browse the repository at this point in the history
This doesn't work if document names have spaces in them. This is because
data props are urlencoded while we are comparing it with raw data.

(cherry picked from commit 272d9e0)

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
mergify[bot] and ankush committed Dec 20, 2022
1 parent a457447 commit bd79b03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frappe/public/js/frappe/list/list_view.js
Expand Up @@ -1256,8 +1256,8 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {

// shift select checkboxes
if (e.shiftKey && this.$checkbox_cursor && !$target.is(this.$checkbox_cursor)) {
const name_1 = this.$checkbox_cursor.data().name;
const name_2 = $target.data().name;
const name_1 = decodeURIComponent(this.$checkbox_cursor.data().name);
const name_2 = decodeURIComponent($target.data().name);
const index_1 = this.data.findIndex((d) => d.name === name_1);
const index_2 = this.data.findIndex((d) => d.name === name_2);
let [min_index, max_index] = [index_1, index_2];
Expand All @@ -1268,7 +1268,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {

let docnames = this.data.slice(min_index + 1, max_index).map((d) => d.name);
const selector = docnames
.map((name) => `.list-row-checkbox[data-name="${name}"]`)
.map((name) => `.list-row-checkbox[data-name="${encodeURIComponent(name)}"]`)
.join(",");
this.$result.find(selector).prop("checked", true);
}
Expand Down

0 comments on commit bd79b03

Please sign in to comment.