How to return to previous page after submit?
How to return to previous page after submit?
Hello,
First to say that your product is great.
I'll try to explain my needs here. I have a table with general information for a product and when product is selected I generate another table with additional information about the selected product. Only the first table is DataTable second one is pure html table. My problem is that after select DataTable is always returning to page 1. How to stay on the same page after submit?
Here is my code for the table:
var dataSet = [
<%for(ProductContent content : productListCollection){
%><%i++;%>
['<input type="radio" name="action" id="action" value="<%=Integer.toString(content.getNumber())%>">','<%= content.getName()%>','<%= content.getId()%>'<%if(i < clientListCollection.size()){%>],<%}else{%>]<%}%><%}
%>];
$(document).ready(function() {
$('#client_html').html( '
' );
$('#client_table').dataTable( {
"createdRow": function ( row, data, index ) {
if ( data[1] == 'Yes') {
$('td', row).addClass('highlight');
}
},
"data": dataSet,
"autoWidth": false,
"iDisplayLength": 25,
"bLengthChange": true,
"columns": [
{"title": "Details", "sWidth": "5%"},
{"title": "Number", "sWidth": "5%"},
{"title": "Name", "sWidth": "10%"},
{"title": "Id","sWidth": "40%", "sClass": "center"}
],
} );
$('table.display').dataTable();
} );
Thank you for your help here.
Best regards,
Milcho
Answers
Have a look at state saving
http://datatables.net/reference/api/state()
As I understand it you can store the current table state and load it again when you need to