Merge pull request #197 from sosedoff/sticky-tabs

Make tabs sticky: remember tab when switching between tables
This commit is contained in:
Dan Sosedoff 2016-11-06 22:19:16 -06:00 committed by GitHub
commit ec013488ff
2 changed files with 24 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -304,6 +304,9 @@ function setCurrentTab(id) {
$("#nav ul li.selected").removeClass("selected"); $("#nav ul li.selected").removeClass("selected");
$("#" + id).addClass("selected"); $("#" + id).addClass("selected");
// Persist tab selection into the session storage
sessionStorage.setItem("tab", id);
} }
function showQueryHistory() { function showQueryHistory() {
@ -815,7 +818,23 @@ $(document).ready(function() {
$(".filters select, .filters input").val(""); $(".filters select, .filters input").val("");
showTableInfo(); showTableInfo();
showTableContent();
switch(sessionStorage.getItem("tab")) {
case "table_content":
showTableContent();
break;
case "table_structure":
showTableStructure();
break;
case "table_constraints":
showTableConstraints();
break;
case "table_indexes":
showTableIndexes();
break;
default:
showTableContent();
}
}); });
$("#results").on("click", "a.row-action", function(e) { $("#results").on("click", "a.row-action", function(e) {