Search code examples
smartgwt

Changing the default text of SmartGWT listgrid


How can I change the text which the smartgwt listgrid show by default when there is no records to display. For e.g. now it displays a text "No items to show." I want to be able to change this text. Another reason for changing is I have RTL language for my application and want to be able to enter the text in that language.


Solution

  • From ListGrid source:

    /**
     * The string to display in the body of a listGrid with an empty data array, if showEmptyMessage is true.
     *
     * @param emptyMessage emptyMessage Default value is "No items to show."
     * @see com.smartgwt.client.widgets.grid.ListGrid#setShowEmptyMessage
     * @see com.smartgwt.client.widgets.grid.ListGrid#setEmptyMessageStyle
     * @see <a href="http://www.smartclient.com/smartgwt/showcase/#grid_appearance_empty_grid" target="examples">Empty grid Example</a>
     */
    public void setEmptyMessage(String emptyMessage) {
        setAttribute("emptyMessage", emptyMessage, true);
    }