My parent doctype name is student with fields name1(data) and passport_details(Table).
Child table name is StudentPassport with fields passport_number, issue_date and expiry_date. I want to sort the child table in ASC/DESC order based on expiry_date. I tried with the below client script
No 2nd console output and not able to perform sort in the child table. Also In Customize Form - StudentPassport, I set the sort field as expiry_date and sort order as ASC in list settings but not worked.
The following Client Script worked. Anyway thanks @NCP
var sortedEntries = frm.doc.passport_details.sort(function (a, b) {
var dateA = new Date(a.expiry_date);
var dateB = new Date(b.expiry_date);
return dateB - dateA;
});
frm.set_value('passport_details', sortedEntries);
frm.refresh_field('passport_details');