EasyUI Forum
May 15, 2024, 12:44:16 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: datagrid emptyMsg property doesn't work  (Read 4831 times)
fguibert
Newbie
*
Posts: 23


View Profile
« 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
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: August 20, 2018, 07:54:20 AM »

Set the 'emptyMsg' property with specified value:
Code:
$('#dg').datagrid({
emptyMsg: 'No record found'
})
Logged
fguibert
Newbie
*
Posts: 23


View Profile
« Reply #2 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>
« Last Edit: August 21, 2018, 01:10:46 AM by fguibert » Logged
fguibert
Newbie
*
Posts: 23


View Profile
« Reply #3 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'"
    >
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!