How to get rid of the 'No records found message' in PrimeNG datatable?

我的梦境 提交于 2019-12-30 10:34:11

问题


I created a data table using PrimeNG. I just created 2 headings for the datatable. I'll actually fetch the data from the server, hence if there is no data I do not want the default 'No records found message' to be shown.

I would like the table to be empty if there is no data in the table.

Please take a look at the table that I have created below :

<p-dataTable>
       <p-headerColumnGroup >
         <p-row>
           <p-column header="Weekday"></p-column>
           <p-column header="Set Class Time"></p-column>

         </p-row>
       </p-headerColumnGroup>
 </p-dataTable>

回答1:


You can use the emptyMessage property to override this message :

<p-dataTable emptyMessage="">
    ...
</p-dataTable>

Edit : If you don't want to see the border, hide ui-datatable-emptymessage class with CSS. Btw, you don't need to use emptyMessage property anymore in that case.

.ui-datatable-emptymessage {
    display:none;
}


来源:https://stackoverflow.com/questions/48108916/how-to-get-rid-of-the-no-records-found-message-in-primeng-datatable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!