Merge pull request #32567 from Vengadesh27/search_bar
feat: Dynamic and configurable child table search bar
This commit is contained in:
commit
c74667caa5
3 changed files with 17 additions and 2 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue