Allow cell level formatters
This commit is contained in:
parent
e5af37fb07
commit
d110ab7c59
6
dist/frappe-datatable.cjs.js
vendored
6
dist/frappe-datatable.cjs.js
vendored
@ -2583,13 +2583,15 @@ class CellManager {
|
||||
const hasDropdown = isHeader && cell.dropdown !== false;
|
||||
const dropdown = hasDropdown ? `<div class="data-table-dropdown">${getDropdownHTML()}</div>` : '';
|
||||
|
||||
const customFormatter = cell.column.format || cell.format || null;
|
||||
|
||||
let contentHTML;
|
||||
if (isHeader || isFilter || !cell.column.format) {
|
||||
if (isHeader || isFilter || !customFormatter) {
|
||||
contentHTML = cell.content;
|
||||
} else {
|
||||
const row = this.datamanager.getRow(cell.rowIndex);
|
||||
const data = this.datamanager.getData(cell.rowIndex);
|
||||
contentHTML = cell.column.format(cell.content, row, cell.column, data);
|
||||
contentHTML = customFormatter(cell.content, row, cell.column, data);
|
||||
}
|
||||
|
||||
if (this.options.treeView && !(isHeader || isFilter) && cell.indent !== undefined) {
|
||||
|
||||
6
dist/frappe-datatable.js
vendored
6
dist/frappe-datatable.js
vendored
@ -2582,13 +2582,15 @@ class CellManager {
|
||||
const hasDropdown = isHeader && cell.dropdown !== false;
|
||||
const dropdown = hasDropdown ? `<div class="data-table-dropdown">${getDropdownHTML()}</div>` : '';
|
||||
|
||||
const customFormatter = cell.column.format || cell.format || null;
|
||||
|
||||
let contentHTML;
|
||||
if (isHeader || isFilter || !cell.column.format) {
|
||||
if (isHeader || isFilter || !customFormatter) {
|
||||
contentHTML = cell.content;
|
||||
} else {
|
||||
const row = this.datamanager.getRow(cell.rowIndex);
|
||||
const data = this.datamanager.getData(cell.rowIndex);
|
||||
contentHTML = cell.column.format(cell.content, row, cell.column, data);
|
||||
contentHTML = customFormatter(cell.content, row, cell.column, data);
|
||||
}
|
||||
|
||||
if (this.options.treeView && !(isHeader || isFilter) && cell.indent !== undefined) {
|
||||
|
||||
@ -2582,13 +2582,15 @@ class CellManager {
|
||||
const hasDropdown = isHeader && cell.dropdown !== false;
|
||||
const dropdown = hasDropdown ? `<div class="data-table-dropdown">${getDropdownHTML()}</div>` : '';
|
||||
|
||||
const customFormatter = cell.column.format || cell.format || null;
|
||||
|
||||
let contentHTML;
|
||||
if (isHeader || isFilter || !cell.column.format) {
|
||||
if (isHeader || isFilter || !customFormatter) {
|
||||
contentHTML = cell.content;
|
||||
} else {
|
||||
const row = this.datamanager.getRow(cell.rowIndex);
|
||||
const data = this.datamanager.getData(cell.rowIndex);
|
||||
contentHTML = cell.column.format(cell.content, row, cell.column, data);
|
||||
contentHTML = customFormatter(cell.content, row, cell.column, data);
|
||||
}
|
||||
|
||||
if (this.options.treeView && !(isHeader || isFilter) && cell.indent !== undefined) {
|
||||
|
||||
@ -695,13 +695,15 @@ export default class CellManager {
|
||||
const hasDropdown = isHeader && cell.dropdown !== false;
|
||||
const dropdown = hasDropdown ? `<div class="data-table-dropdown">${getDropdownHTML()}</div>` : '';
|
||||
|
||||
const customFormatter = cell.column.format || cell.format || null;
|
||||
|
||||
let contentHTML;
|
||||
if (isHeader || isFilter || !cell.column.format) {
|
||||
if (isHeader || isFilter || !customFormatter) {
|
||||
contentHTML = cell.content;
|
||||
} else {
|
||||
const row = this.datamanager.getRow(cell.rowIndex);
|
||||
const data = this.datamanager.getData(cell.rowIndex);
|
||||
contentHTML = cell.column.format(cell.content, row, cell.column, data);
|
||||
contentHTML = customFormatter(cell.content, row, cell.column, data);
|
||||
}
|
||||
|
||||
if (this.options.treeView && !(isHeader || isFilter) && cell.indent !== undefined) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user