Individual column searching (text inputs)
Individual column searching (text inputs)
My problem is that column searching is working fine , drawing the search and saving it,But when I came to the same page after working through my searched information, the text in tfoot is lost but not in global search my code
// This function is to Setup - add a text input to each footer cell
function columnSearch() {
$('#gridWrapper tfoot th').each(function() {
var title = $('#gridWrapper thead th').eq($(this).index()).text();
$(this).html('
');
});
}
var GRID = $('#QV_Search').DataTables()
//my code
// Enable the Global QueueView Searching
$('#QViewSRCH').on('keyup change', function() {
GRID
.search(this.value)
.draw();
});
// Enable the multi column seach
function columnSearch();
GRID.columns().every(function(e) {
var that = this;
$(this.footer())
.find('input')
.on('keypress', function(e) {
if (e.which == 13) {
that.search(this.value).draw();
}
});
});
//my code
So all functions are working perfectly , its drawing the indicviual search , only my text I enter keep getting lost
Please if any can help on this
I also tried to use local storage just like datatable engine, my information I can see but how to put it back
//function to convert text into array and save it in localStorage.
function columnSearchText(){
$('#gridWrapper tfoot th input').on('keydown', function(e) {
if (e.which == 13) {
var gridFooter = [];
$('#gridWrapper tfoot th input').each(function(index, elem) {
gridFooter.push($(elem).val());
//console.log($(elem).val());
});
localStorage.setItem('value', JSON.stringify(gridFooter));
var savedSearchText = JSON.parse(localStorage.getItem('value'));
}
});
}
Answers
Done.
Any body needs it let me know.