diff --git a/frappe/core/doctype/doctype/doctype.json b/frappe/core/doctype/doctype/doctype.json index 5c550637b6..898fd81011 100644 --- a/frappe/core/doctype/doctype/doctype.json +++ b/frappe/core/doctype/doctype/doctype.json @@ -33,6 +33,7 @@ "editable_grid", "quick_entry", "grid_page_length", + "rows_threshold_for_grid_search", "cb01", "track_changes", "track_seen", @@ -697,6 +698,14 @@ "fieldname": "protect_attached_files", "fieldtype": "Check", "label": "Protect Attached Files" + }, + { + "default": "0", + "depends_on": "istable", + "fieldname": "rows_threshold_for_grid_search", + "fieldtype": "Int", + "label": "Rows Threshold for Grid Search", + "non_negative": 1 } ], "grid_page_length": 50, @@ -775,7 +784,7 @@ "link_fieldname": "document_type" } ], - "modified": "2025-03-27 18:16:53.286909", + "modified": "2025-05-21 21:58:59.947374", "modified_by": "Administrator", "module": "Core", "name": "DocType", diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index 3939240bfb..77a3864860 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -161,6 +161,7 @@ class DocType(Document): restrict_to_domain: DF.Link | None route: DF.Data | None row_format: DF.Literal["Dynamic", "Compressed"] + rows_threshold_for_grid_search: DF.Int search_fields: DF.Data | None sender_field: DF.Data | None sender_name_field: DF.Data | None diff --git a/frappe/public/js/frappe/form/grid_row.js b/frappe/public/js/frappe/form/grid_row.js index ee739ef891..11fcdaf058 100644 --- a/frappe/public/js/frappe/form/grid_row.js +++ b/frappe/public/js/frappe/form/grid_row.js @@ -852,8 +852,13 @@ export default class GridRow { show_search_row() { // show or remove search columns based on grid rows + let show_length = + this.grid?.meta?.rows_threshold_for_grid_search > 0 + ? this.grid.meta.rows_threshold_for_grid_search + : 20; this.show_search = - this.show_search && (this.grid?.data?.length >= 20 || this.grid.filter_applied); + this.show_search && + (this.grid?.data?.length >= show_length || this.grid.filter_applied); !this.show_search && this.wrapper.remove(); return this.show_search; }