I am new to jsp / servlet and related domains. I am trying to display a message on a gridPagingToolbar based on length of myDataStoreDs.
<j:gridPagingToolbar dataStoreId="myDataStoreDs" gridId="myExampleGrid" exportEnabled="true">
<jsp:attribute name="startItems">
myLib.Util.removeNulls([null, "${message}"
, <j:button type='edit' labelKey="myLabel" handler="myHandler" hidden="true" itemId="myBtn"/>
])
</jsp:attribute>
</j:gridPagingToolbar>
The variable "message" should have a String based upon the length of the datastore - such as null for datastore length 0, some custom message otherwise. I should do this check on my html.jsp, and the datastore is being populated by a rest POST through a js.jsp.
Any suggestions on the code to read the datastore length and populate the message? I have used
<c:if test="someRequestAttribute">
for other purposes, but not able to get the correct way to implement this one.
I figured it out.
<j:gridPagingToolbar dataStoreId="myDataStoreDs" gridId="myExampleGrid" exportEnabled="true">
<jsp:attribute name="startItems">
myLib.Util.removeNulls([null
, {
xtype: 'tbtext',
itemId: 'toolbarText',
text: "<j:jsMessage key='diplay text' bundle='bundle.myResourceBundle' />"
}
, <j:button type='edit' labelKey="myLabel" handler="myHandler" hidden="true" itemId="myBtn"/>
])
</jsp:attribute>
</j:gridPagingToolbar>
In the js.jsp part, the rest datastore length can be checked.
var text = pageConfigName.myExampleGrid.down("#toolbarText");
if(pageConfigName.myDatastoreDs.getTotalCount() == 0) {
text.hidden = true;
}