Merge pull request #32567 from Vengadesh27/search_bar

feat: Dynamic and configurable child table search bar
This commit is contained in:
Ejaaz Khan 2025-05-22 10:31:38 +05:30 committed by GitHub
commit c74667caa5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 2 deletions

View file

@ -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",

View file

@ -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

View file

@ -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;
}