Moving/Recreating the resultsTable_length
Moving/Recreating the resultsTable_length
I want free control to put the resultsTable_length select box in a 'filters' section. It is changing the returned results, but it does not update the results 1-10 and pagination is not updated to reflect it either.
https://usedlens.co.uk/
Go to filters, changed the 'show entries' filter from 10 to another value
I am sending the length parameter from the select box
I have set lengthChange: false, to stop it appearing
data: function(data){
data.pricemin = $('#pricemin').val();
data.pricemax = $('#pricemax').val();
data.producttype = $("input[name='producttype']:checked").val();
data.length = $('#resultsTable_length').children("option:selected").val();
and the code for the new select field
$('#resultsTable_length').change( function() {
$('html, body').animate({
scrollTop: 150
}, 300);
resultsTable.draw();
} );
I had another idea, I keep lengthChange: true and have the new select box affect the default one
$('#filterlength').change( function() {
$('select[name="resultsTable_length"]').val($(this).children("option:selected").val());
$('html, body').animate({
scrollTop: 150
}, 300);
resultsTable.draw();
} );
Whilst the resultsTable_length selects the matching value, it does not trigger any event.
This question has an accepted answers - jump to answer
Answers
Just found the solution lengthChange:true, display:none on the original select box, and add this to my new filter select
Yes. You can also use the
dom
option to remove the original page length control.Allan