Skip to content

Commit df5cab0

Browse files
author
liyzh
committed
add hash tag to table hyperlink, made refresh data easy(refresh page)
1 parent 4404a6a commit df5cab0

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

  • debug-db/src/main/assets

debug-db/src/main/assets/app.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ function getDBList() {
8181

8282
}
8383

84+
var lastTableName = getHashValue('table');
8485
function openDatabaseAndGetTableList(db) {
8586

8687
if("APP_SHARED_PREFERENCES" == db) {
@@ -110,10 +111,14 @@ function openDatabaseAndGetTableList(db) {
110111
}
111112
$('#table-list').empty()
112113
for(var count = 0; count < tableList.length; count++){
113-
var tableName = tableList[count];
114-
$("#table-list").append("<a href='#' data-db-name='"+db+"' data-table-name='"+tableName+"' class='list-group-item' onClick='getData(\""+ tableName + "\");'>" +tableName + "</a>");
115-
}
116-
114+
var tableName = tableList[count];
115+
$("#table-list").append("<a href='#table=" + tableName + "' data-db-name='" + db + "' data-table-name='" + tableName
116+
+ "' class='list-group-item' onClick='getData(\"" + tableName + "\");'>" + tableName + "</a>");
117+
}
118+
119+
if (lastTableName !== null) {
120+
$('a[data-table-name=' + lastTableName + ']').trigger('click');
121+
}
117122
}});
118123

119124
}
@@ -389,3 +394,8 @@ function showErrorInfo(message){
389394
snackbarElement.removeClass("show");
390395
}, 3000);
391396
}
397+
398+
function getHashValue(key) {
399+
var matches = location.hash.match(new RegExp(key + '=([^&]*)'));
400+
return matches ? matches[1] : null;
401+
}

0 commit comments

Comments
 (0)