Add js method to get current table

This commit is contained in:
Dan Sosedoff
2014-12-01 20:51:20 -06:00
parent af75cf55b5
commit 590d47906e
2 changed files with 269 additions and 261 deletions

View File

@@ -53,6 +53,10 @@ function unescapeHtml(str){
return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
}
function getCurrentTable() {
return $("#tables").attr("data-current");
}
function resetTable() {
$("#results").
attr("data-mode", "").
@@ -115,7 +119,7 @@ function showQueryHistory() {
}
function showTableIndexes() {
var name = $("#tables li.selected").text();
var name = getCurrentTable();
if (name.length == 0) {
alert("Please select a table!");
@@ -133,7 +137,7 @@ function showTableIndexes() {
}
function showTableInfo() {
var name = $("#tables li.selected").text();
var name = getCurrentTable();
if (name.length == 0) {
alert("Please select a table!");
@@ -151,7 +155,7 @@ function showTableInfo() {
}
function showTableContent() {
var name = $("#tables li.selected").text();
var name = getCurrentTable();
if (name.length == 0) {
alert("Please select a table!");
@@ -171,7 +175,7 @@ function showTableContent() {
}
function showTableStructure() {
var name = $("#tables li.selected").text();
var name = getCurrentTable();
if (name.length == 0) {
alert("Please select a table!");
@@ -408,6 +412,8 @@ $(document).ready(function() {
$("#tables").on("click", "li", function() {
$("#tables li.selected").removeClass("selected");
$(this).addClass("selected");
$("#tables").attr("data-current", $.trim($(this).text()));
showTableContent();
showTableInfo();
});