EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: fguibert on August 20, 2018, 06:41:55 AM



Title: datagrid emptyMsg property doesn't work
Post by: fguibert on August 20, 2018, 06:41:55 AM
Hi

in datagrid definition, we have an "emptyMsg" property, but nothing is never showed when there is no data loaded in the datagrid.
what is the use of this property ? how to display a "No record found" message when data are empty ?

thanks for all


Title: Re: datagrid emptyMsg property doesn't work
Post by: jarry on August 20, 2018, 07:54:20 AM
Set the 'emptyMsg' property with specified value:
Code:
$('#dg').datagrid({
emptyMsg: 'No record found'
})


Title: Re: datagrid emptyMsg property doesn't work
Post by: fguibert on August 21, 2018, 01:08:43 AM
of course I try.... without success : datagrid is empty with no message when there is no data returned.
I try to return an empty Json response and and empty Json array response with footer (see below), but it doesn't change anything.
So how to alert the user when the datagrid is empty ? (without using an alert box)

thanks

empty array in Json repsonse :
Code:
{"total":0,"rows":[],"footer":[{"name":"items:","items":0,"iconCls":"icon-sum"}]}

my datagrid definition :

Code:
<table id="dg" 
 class="easyui-datagrid"   style="width:100%;height:250px"
 url="http://localhost/rest/invitations/list/received"
    emptyMsg="No record found"  
    loadMsg="Loading, please wait..."
    fitColumns="true"
    collapsible="false"  
    showHeader="false"
    singleSelect="true"
    remoteSort="false"
    remoteFilter="false"
    >
  
  
        <thead>
            <tr>
                <th field="urlLogo"></th>
                <th field="lastnameContact"></th>
                <th field="fisrtnameContact"></th>
            </tr>
        </thead>
        
        
</table>


Title: Re: datagrid emptyMsg property doesn't work
Post by: fguibert on August 21, 2018, 01:19:05 AM
Oh okay... I have to declare this property as a data-option, doesn't work in the HTML tag way
I modified this and it works now
thanks !


<table id="invitRecues"
 class="easyui-datagrid"   style="width:100%;height:250px"
 url="${pageContext.request.contextPath}/rest/invitations/list/recues"
    emptyMsg="No record found"  
    toolbar="#toolbar_invitRecues"
    loadMsg="Chargement en cours, veuillez patienter..."
    fitColumns="true"
    collapsible="false"  
    showHeader="false"
    singleSelect="true"
    remoteSort="false"
    remoteFilter="false"
    data-options="emptyMsg: 'No record found'"
    >