Clone wiki

grails-datatables / RowCountInitialization

Row Count Initialization

You may want to display the number of rows in your table elsewhere on your page, however if you table gets its data from the server via AJAX, you may not know the number of rows until after the table has been initialized. The plugin provides a way to use a tag that will be updated to contain the number of rows in your table after it has been initialized.

To do this, create a span (or div) element with the class MyTableCount, where MyTable is the name of your table. After the table is initialized, the plugin will insert the number of rows into the span.

For example:

<dt:datatable name="MyTable" domainClass="datatablestest.Person" type="serverData">
    <dt:column name="firstName"/>
    <dt:column name="lastName"/>
The table has <span class="MyTableCount"></span> rows.

Back to Home.