From 1d763704244ec7e59faa86799e6ed8aa7d195681 Mon Sep 17 00:00:00 2001 From: Hardik Zinzuvadiya <25708027+Z4nzu@users.noreply.github.com> Date: Fri, 21 Feb 2025 12:19:05 +0530 Subject: [PATCH] feat: Add Grid Page Length field for child tables in DocType --- frappe/core/doctype/doctype/doctype.json | 11 ++++++++++- frappe/core/doctype/doctype/doctype.py | 1 + frappe/public/js/frappe/form/grid_pagination.js | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/frappe/core/doctype/doctype/doctype.json b/frappe/core/doctype/doctype/doctype.json index dbb210b646..6b9d744e80 100644 --- a/frappe/core/doctype/doctype/doctype.json +++ b/frappe/core/doctype/doctype/doctype.json @@ -31,6 +31,7 @@ "is_calendar_and_gantt", "editable_grid", "quick_entry", + "grid_page_length", "cb01", "track_changes", "track_seen", @@ -680,6 +681,14 @@ "hidden": 1, "label": "Row Format", "options": "Dynamic\nCompressed" + }, + { + "default": "50", + "depends_on": "istable", + "fieldname": "grid_page_length", + "fieldtype": "Int", + "label": "Grid Page Length", + "non_negative": 1 } ], "icon": "fa fa-bolt", @@ -799,4 +808,4 @@ "states": [], "track_changes": 1, "translated_doctype": 1 -} \ No newline at end of file +} diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index d5913e47f5..338a8e99c2 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -121,6 +121,7 @@ class DocType(Document): engine: DF.Literal["InnoDB", "MyISAM"] fields: DF.Table[DocField] force_re_route_to_default_view: DF.Check + grid_page_length: DF.Int has_web_view: DF.Check hide_toolbar: DF.Check icon: DF.Data | None diff --git a/frappe/public/js/frappe/form/grid_pagination.js b/frappe/public/js/frappe/form/grid_pagination.js index 23233d820e..8bb8911ef3 100644 --- a/frappe/public/js/frappe/form/grid_pagination.js +++ b/frappe/public/js/frappe/form/grid_pagination.js @@ -5,7 +5,7 @@ export default class GridPagination { } setup_pagination() { - this.page_length = 50; + this.page_length = this.grid.meta?.grid_page_length || 50; this.page_index = 1; this.total_pages = Math.ceil(this.grid.data.length / this.page_length);