fix: inconsistent link title in report view
This commit is contained in:
parent
56d251527f
commit
697fa243c3
1 changed files with 24 additions and 4 deletions
|
|
@ -147,16 +147,36 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
|
|||
}
|
||||
|
||||
set_link_title_field_value() {
|
||||
let rows = this.datatable?.datamanager?.rows;
|
||||
let link_col_indices = this.datatable?.datamanager?.columns
|
||||
?.filter((c) => c.docfield?.fieldtype === "Link")
|
||||
.map((c) => c.colIndex);
|
||||
|
||||
Object.keys(this.link_title_doctype_fields).forEach(async (key) => {
|
||||
let link_title = await this.get_link_title_field_value(
|
||||
this.link_title_doctype_fields[key],
|
||||
key
|
||||
);
|
||||
|
||||
if (link_title !== undefined) {
|
||||
document.querySelectorAll(`a[data-name="${key}"]`).forEach((el) => {
|
||||
el.innerHTML = link_title;
|
||||
});
|
||||
if (link_title === undefined) return;
|
||||
|
||||
// update visible DOM elements and cell tooltip
|
||||
document.querySelectorAll(`a[data-name="${key}"]`).forEach((el) => {
|
||||
if (el.innerHTML === link_title) return;
|
||||
el.innerHTML = link_title;
|
||||
|
||||
$(el).closest(".dt-cell__content").attr("title", link_title);
|
||||
});
|
||||
|
||||
if (rows?.length && link_col_indices?.length) {
|
||||
for (let row of rows) {
|
||||
for (let ci of link_col_indices) {
|
||||
let cell = row[ci];
|
||||
if (cell?.content === key && cell.html) {
|
||||
cell.html = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue