Question

I want a dandelion datatable to show 15 rows at a time instead of the default 10 rows. Can someone show me how to accomplish this?

Here is some code that I displaying 10 rows at a time with pagination controls to scroll between sets of 10 rows:

<datatables:table id="mydata" data="${mydataset}" cdn="true" row="mr" theme="bootstrap2" 
    cssClass="table table-striped" paginate="true" info="false" 
    cssStyle="width: 150px;" align="left" dom="frtp">
    <datatables:column title="Concept Type" cssStyle="width: 150px;" display="html">
        <c:out value="${mr.something}"/>
    </datatables:column>
</datatables:table>
Was it helpful?

Solution

You can use lengthChange attribute which allows user to select the size of a formatted page from a select menu (sizes are 10, 25, 50 and 100)

this property will only work when paginate="true"

if you don't want to show dropdown and would like change it to 15 then you override below property

global.feature.displayLength=15

default value of above property is 10 thatswhy you are its showing 10 result.

please use below code and give a try

<datatables:table id="mydata" data="${mydataset}" cdn="true" row="mr" theme="bootstrap2" 
    cssClass="table table-striped" paginate="true"  info="false" 
    cssStyle="width: 150px;" align="left" dom="frtp" lengthChange="true">
    <datatables:column title="Concept Type" cssStyle="width: 150px;" display="html">
        <c:out value="${mr.something}"/>
    </datatables:column>
   <datatables:prop name="feature.displayLength" value="15" />
</datatables:table>

How to Override ??

  • you can add a file called datatables.properties at the root of the classpath, allowing you to redefine every property you need. Your custom global configuration will then be merged with the default one.
  • Or you can locally override properties using the <datatables:prop> JSP tag. Just define the property's name and value.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top