-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtbl-selection.js
64 lines (50 loc) · 1.84 KB
/
tbl-selection.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
$( function(){
//window.addingTables=[];
window.showTableList = function(show){
if(show){
$('#table-selection').show(250)
}
else{
$('#table-selection').hide(0)
}
}
window.bindAddTableEvts = function(){
$('#table-btns .ok').on('click', function(event){
App.setAppVisibility();
$('#table-list .selected').each( function(i){
//continue only if it is not added
if(! $(this).hasClass('added')){
var tblName = $.trim($(this).html());
AddTable(tblName);
$(this).addClass('added');
}
})
showTableList(false);
})
$('#table-btns .cancel').on('click', function(event){
showTableList(false);
})
$('#table-list .item').on('click', function(event){
$(this).toggleClass('selected');
})
$('#btn-add-table').on('click', function(event){
schema = $('select[name=schema]').val()
if(schema == ""){
alert("Select a schema and then add tables")
return
}
LoadTableList(schema);
showTableList(true);
});
}
window.removeSelection= function(tableName) {
_.each($('#table-list .item.added').get(),
function(item){
if ($.trim($(item).html()) == tableName){
$(item).removeClass('added');
$(item).removeClass('selected');
}
});
}
showTableList(false);
})