2

I'm using Dandelion DataTable component in version 1.1.0, Thymeleaf and Spring MVC

I can filter the table with number of data and i can use the pagination.

I've problem with this scenario :

  • I click in one line of data and i show its detail in new page
  • I return to the DataTable (previous page), and here, i loose the pagination and number of data (the state of datatable was not saved.

Here is the part of my code :

<table id="table_result" class="table table-striped table-bordered table-hover table-responsive" dt:table="true" dt:url="@{/accor/orders/search}" 
dt:sortable="true" dt:pagingType="full_numbers"
dt:lengthMenu="'10,25,50,100'" dt:pageable="true" dt:info="true" dt:dom="lpirt" dt:theme="bootstrap2" dt:serverside="true" dt:processing="true" 
dt:ajaxParams="getExtraParams" dt:autowidth="false" dt:filterSelector="#filterButton">

How can i save the state of DataTable ?

fay.doca
  • 31
  • 7

2 Answers2

0

Add StateSave and StateLoad callback for this behavior.
There are examples in the official documentation.

sanluck
  • 1,544
  • 1
  • 12
  • 22
0

Just add the attribute <table ... dt:statesave="true"> and it will store in your local storage the current state.

No need to write custom callbacks ;)

user1075613
  • 725
  • 9
  • 13