How do I display all rows after using column().search()
How do I display all rows after using column().search()
I have two tables initialized as DataTables:
supplierTable = $("#SupplierList").DataTable({
"lengthMenu": [4, 10, 25, 50, 100],
"PageLength": 4,
"dom": '<lf<t>pi>'
});
newSupplierTable = $('#NewSupplierList').DataTable({
"dom": '<lf<t>pi>'
});
I then have a drop down list to choose a trade type from. When user chooses a trade, the following code is called:
function tradesListIndexChanged() {
var tradeList = document.getElementById("MainContent_TradesDropDownList");
var tradeSelected = tradeList.options[tradeList.selectedIndex].value;
if (tradeSelect === "Select All"){
????
}
else {
supplierTable.columns(3).search(tradeSelected).draw();
newSupplierTable.columns(3).search(tradeSelected).draw();
}
}
This works great and the correct data is displayed. My question is, how do I display all of the rows after this. I have an option in the drop down for select all. I can't figure out the code that needs to go where the ???'s are.
Thanks,
Patrick
Answers
I figured it out:
if (tradeSelected === "Select All") {
supplierTable.columns(3).search("").draw();
newSupplierTable.columns(3).search("").draw();
}
else {
supplierTable.columns(3).search(tradeSelected).draw();
newSupplierTable.columns(3).search(tradeSelected).draw();
}
I thought I had already tried this, but I must have had a typo somewhere.
Thanks,
Pat