Skip to content

Commit

Permalink
Fix #7614: emptyMessage section not shown (#7615)
Browse files Browse the repository at this point in the history
* fix: Show emptyMessage section when using listTemplate

* fix: Show emptyMessage section when using listTemplate

* chore: Format code
  • Loading branch information
ivanpajon authored Jan 16, 2025
1 parent a4b8e95 commit 146dc17
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/lib/dataview/DataView.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as React from 'react';
import PrimeReact, { localeOption, PrimeReactContext } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { useMergeProps } from '../hooks/Hooks';
import { BarsIcon } from '../icons/bars';
import { SpinnerIcon } from '../icons/spinner';
import { ThLargeIcon } from '../icons/thlarge';
import { Paginator } from '../paginator/Paginator';
import { Ripple } from '../ripple/Ripple';
import { classNames, IconUtils, ObjectUtils } from '../utils/Utils';
import { useMergeProps } from '../hooks/Hooks';
import { DataViewBase, DataViewLayoutOptionsBase } from './DataViewBase';

export const DataViewLayoutOptions = React.memo((inProps) => {
Expand Down Expand Up @@ -286,7 +286,11 @@ export const DataView = React.memo(
if (props.listTemplate) {
const items = getItems(value);

content = ObjectUtils.getJSXElement(props.listTemplate, items, props.layout);
if (ObjectUtils.isNotEmpty(items)) {
content = ObjectUtils.getJSXElement(props.listTemplate, items, props.layout);
} else {
content = createEmptyMessage();
}
} else {
const items = createItems(value);
const gridProps = mergeProps(
Expand Down

0 comments on commit 146dc17

Please sign in to comment.