加载表内容时隐藏 Primefaces 数据表“未找到记录" [英] Hide Primefaces datatable 'No Records Found' while loading the table content
问题描述
在我的应用程序中,我正在加载我的数据表,默认值放置在第一页(登录后).加载数据时,数据表提示未找到记录",这让用户感到困惑.我如何隐藏它正在加载?
In my application im loading my data table with default values which placed in first page(After Logged in).while loading data,data table prompts 'No Record Found' which is confusing to the user.how do i hide that while loading in progress ?
推荐答案
我知道这有点明显,但是当您显示默认值时,您可以在 emptyMessage=""
中设置 >
.
I know it's a bit obvious, but as you display default values anyway, you could set emptyMessage=""
in your <p:dataTable>
.
但是,如果您需要稍后显示 emptyMessage
(例如,当加载特定于用户的数据时),您可以在第一次加载时使用以下内容禁用"它:>
However, if you need an emptyMessage
to be displayed later (e.g. when user-specific data is to be loaded), you could "disable" it upon first load using something like this:
emptyMessage="#{dataBean.firstLoad ? '' : 'No records found.'}"
其中 firstLoad
将是您的支持 bean 中的一个方法,它在用户刚刚登录时返回 true
(例如要加载默认值),以及 false
否则,这意味着应该加载特定于用户的数据并且
实际上可能为空.
where firstLoad
would be a method in your backing bean which returns true
when the user has just logged in (e.g. default values are to be loaded), and false
when not, which would mean that user-specific data should be loaded and the <p:dataTable>
could actually be empty.
这篇关于加载表内容时隐藏 Primefaces 数据表“未找到记录"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!