ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Manipulating Child tables with pagination

I tried to use

frm.doc.items.length

But I get Error

purchase_order__custom_js:3 Uncaught (in promise) ReferenceError: frm is not defined

My problem is that when I use

cur_frm.get_field(“items”).grid.grid_rows.length

I get the correct length.
but if the items table is more than 50, the form is paginated and I get errors

The solution is to use the $.each()function as per the below post: