Allow cell level formatters

This commit is contained in:
Faris Ansari 2018-04-04 16:47:08 +05:30
parent e5af37fb07
commit d110ab7c59
4 changed files with 16 additions and 8 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {