diff --git a/cypress/integration/list_paging.js b/cypress/integration/list_paging.js
index cd4e2bc68d..494ca6ae74 100644
--- a/cypress/integration/list_paging.js
+++ b/cypress/integration/list_paging.js
@@ -37,6 +37,6 @@ context("List Paging", () => {
cy.get(".list-paging-area .list-count").should("contain.text", "500 of");
cy.get(".list-paging-area .btn-more").click();
- cy.get(".list-paging-area .list-count").should("contain.text", "1000 of");
+ cy.get(".list-paging-area .list-count").should("contain.text", "1,000 of");
});
});
diff --git a/frappe/public/js/frappe/list/list_view.js b/frappe/public/js/frappe/list/list_view.js
index f64c4e8d55..5c2cabfe54 100644
--- a/frappe/public/js/frappe/list/list_view.js
+++ b/frappe/public/js/frappe/list/list_view.js
@@ -501,9 +501,9 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
freeze() {
if (this.list_view_settings && !this.list_view_settings.disable_count) {
- this.$result
- .find(".list-count")
- .html(`${__("Refreshing", null, "Document count in list view")}...`);
+ this.get_count_element().html(
+ `${__("Refreshing", null, "Document count in list view")}...`
+ );
}
}
@@ -619,22 +619,22 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
render_count() {
if (this.list_view_settings.disable_count) return;
- this.get_count_str().then((str) => {
- let me = this;
- let count_element = this.$result.find(".list-count");
- count_element.html(`${str}`);
+ let me = this;
+ let $count = this.get_count_element();
+ this.get_count_str().then((count) => {
+ $count.html(`${count}`);
if (this.count_upper_bound) {
- count_element.attr(
+ $count.attr(
"title",
__(
"The count shown is an estimated count. Click here to see the accurate count."
)
);
- count_element.tooltip({ delay: { show: 600, hide: 100 }, trigger: "hover" });
- count_element.on("click", () => {
+ $count.tooltip({ delay: { show: 600, hide: 100 }, trigger: "hover" });
+ $count.on("click", () => {
me.count_upper_bound = 0;
- count_element.off("click");
- count_element.tooltip("disable");
+ $count.off("click");
+ $count.tooltip("disable");
me.freeze();
me.render_count();
});
@@ -642,6 +642,10 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
});
}
+ get_count_element() {
+ return this.$result.find(".list-count");
+ }
+
get_header_html() {
if (!this.columns) {
return;
diff --git a/frappe/public/js/frappe/views/file/file_view.js b/frappe/public/js/frappe/views/file/file_view.js
index fb2a12a268..de787e10c6 100644
--- a/frappe/public/js/frappe/views/file/file_view.js
+++ b/frappe/public/js/frappe/views/file/file_view.js
@@ -231,6 +231,7 @@ frappe.views.FileView = class FileView extends frappe.views.ListView {
} else {
super.render();
this.render_header();
+ this.render_count();
}
}
diff --git a/frappe/public/js/frappe/views/reports/report_view.js b/frappe/public/js/frappe/views/reports/report_view.js
index 725ebd06a0..8e54c43c97 100644
--- a/frappe/public/js/frappe/views/reports/report_view.js
+++ b/frappe/public/js/frappe/views/reports/report_view.js
@@ -220,19 +220,14 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
this.setup_datatable(this.data);
}
- render_count() {
- if (this.list_view_settings?.disable_count) {
- return;
- }
- let $list_count = this.$paging_area.find(".list-count");
- if (!$list_count.length) {
- $list_count = $("")
+ get_count_element() {
+ let $count = this.$paging_area.find(".list-count");
+ if (!$count.length) {
+ $count = $("")
.addClass("text-muted list-count")
.prependTo(this.$paging_area.find(".level-right"));
}
- this.get_count_str().then((str) => {
- $list_count.text(str);
- });
+ return $count;
}
on_update(data) {