Skip to content

Commit

Permalink
have a typesafe way to implement col.cssClass
Browse files Browse the repository at this point in the history
  • Loading branch information
eaenriquez committed Jan 15, 2024
1 parent 9651a1d commit d78148b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/datagrid/datagrid.formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,14 @@ const formatters = {
return '';
}

const columnCssClass = col.cssClass(row, cell, value, col, item) || '';
let columnCssClass = '';
if (typeof col.cssClass === 'string') {
columnCssClass = col.cssClass;
}

if (typeof col.cssClass === 'function') {
columnCssClass = col.cssClass(row, cell, value, col, item) || '';
}

return col.icon ?
(`<a href="${colHref}"${disableAttr} class="btn-icon row-btn ${columnCssClass}" ${(!api.settings.rowNavigation ? '' : 'tabindex="-1"')}${(col.hyperlinkTooltip ? ` title="${col.hyperlinkTooltip}"` : '')}>
Expand Down

0 comments on commit d78148b

Please sign in to comment.