From 2f80e87f7088b6c748ec8305c253e3d95a24836f Mon Sep 17 00:00:00 2001 From: habubey Date: Tue, 29 Aug 2023 17:03:17 +0300 Subject: [PATCH] Related #4432, #4602 - For DataTable --- components/lib/componentbase/ComponentBase.js | 2 +- components/lib/datatable/BodyCell.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/lib/componentbase/ComponentBase.js b/components/lib/componentbase/ComponentBase.js index 8bbd4ad092..3a3d256d3e 100644 --- a/components/lib/componentbase/ComponentBase.js +++ b/components/lib/componentbase/ComponentBase.js @@ -483,7 +483,7 @@ export const ComponentBase = { const getOptionValue = (obj = {}, key = '', params = {}) => { const fKeys = String(ObjectUtils.toFlatCase(key)).split('.'); const fKey = fKeys.shift(); - const matchedPTOption = Object.keys(obj).find((k) => ObjectUtils.toFlatCase(k) === fKey) || ''; + const matchedPTOption = ObjectUtils.isNotEmpty(obj) ? Object.keys(obj).find((k) => ObjectUtils.toFlatCase(k) === fKey) : ''; return fKey ? (ObjectUtils.isObject(obj) ? getOptionValue(ObjectUtils.getJSXElement(obj[matchedPTOption], params), fKeys.join('.'), params) : undefined) : ObjectUtils.getJSXElement(obj, params); }; diff --git a/components/lib/datatable/BodyCell.js b/components/lib/datatable/BodyCell.js index 5a5aa7b6a4..d3326e8b91 100644 --- a/components/lib/datatable/BodyCell.js +++ b/components/lib/datatable/BodyCell.js @@ -571,7 +571,7 @@ export const BodyCell = React.memo((props) => { { className: cx('columnTitle') }, - getColumnProp('columnTitle') + getColumnPTOptions('columnTitle') ); const title = props.responsiveLayout === 'stack' && {ObjectUtils.getJSXElement(header, { props: props.tableProps })}; @@ -623,7 +623,7 @@ export const BodyCell = React.memo((props) => { { className: cx('rowReorderIcon') }, - getColumnProp('rowReorderIcon') + getColumnPTOptions('rowReorderIcon') ); const rowReorderIcon = getColumnProp('rowReorderIcon') || ; @@ -634,7 +634,7 @@ export const BodyCell = React.memo((props) => { className: cx('rowTogglerIcon'), 'aria-hidden': true }, - getColumnProp('rowTogglerIcon') + getColumnPTOptions('rowTogglerIcon') ); const icon = props.expanded ? props.expandedRowIcon || : props.collapsedRowIcon || ; const togglerIcon = IconUtils.getJSXIcon(icon, { ...rowTogglerIconProps }, { props }); @@ -671,9 +671,9 @@ export const BodyCell = React.memo((props) => { } } else if (isRowEditor && rowEditor) { let rowEditorProps = {}; - const rowEditorSaveIconProps = mergeProps({ className: cx('rowEditorSaveIcon') }, getColumnProp('rowEditorSaveIconProps')); - const rowEditorCancelIconProps = mergeProps({ className: cx('rowEditorCancelIcon') }, getColumnProp('rowEditorCancelIconProps')); - const rowEditorInitIconProps = mergeProps({ className: cx('rowEditorInitIcon') }, getColumnProp('rowEditorInitIconProps')); + const rowEditorSaveIconProps = mergeProps({ className: cx('rowEditorSaveIcon') }, getColumnPTOptions('rowEditorSaveIcon')); + const rowEditorCancelIconProps = mergeProps({ className: cx('rowEditorCancelIcon') }, getColumnPTOptions('rowEditorCancelIcon')); + const rowEditorInitIconProps = mergeProps({ className: cx('rowEditorInitIcon') }, getColumnPTOptions('rowEditorInitIcon')); const rowEditorSaveIcon = IconUtils.getJSXIcon(props.rowEditorSaveIcon || , { ...rowEditorSaveIconProps }, { props }); const rowEditorCancelIcon = IconUtils.getJSXIcon(props.rowEditorCancelIcon || , { ...rowEditorCancelIconProps }, { props }); const rowEditorInitIcon = IconUtils.getJSXIcon(props.rowEditorInitIcon || , { ...rowEditorInitIconProps }, { props });