I’m using Struts2 JQuery grids and it works fine.
Here is an example of grid:
<s:url var="remoteurl" action="jsontable"/>
<sjg:grid
id="gridtable"
caption="Customer Examples"
dataType="json"
href="%{remoteurl}"
pager="true"
gridModel="gridModel"
rowList="10,15,20"
rowNum="15"
rownumbers="true"
>
<sjg:gridColumn name="id" index="id" title="ID" formatter="integer" sortable="false"/>
<sjg:gridColumn name="name" index="name" title="Name" sortable="true"/>
<sjg:gridColumn name="country" index="country" title="Country" sortable="false"/>
<sjg:gridColumn name="city" index="city" title="City" sortable="false"/>
<sjg:gridColumn name="creditLimit" index="creditLimit" title="Credit Limit" formatter="currency" sortable="false"/>
</sjg:grid>
I would like to display a specific message when the grid is empty instead of showing an empty grid. I know that this can be done by encapsulating the whole grid in a s:if statement but I would like to avoid retrieving information twice if the grid has contents (one for the if statement, then a second time for the grid itself).
Is there an option to do the following “isEmpty” message?
<sjg:grid
id="gridtable"
ifEmpty="No data to display!"
Or some other mechanism like that where I can display a button to create a new entry?
you can use the event onCompleteTopics and some script like this:
See reference on http://code.google.com/p/struts2-jquery/wiki/GridTag#Topics