Fix adding a table from list, do not crash the designer if impossible to add

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2019-11-20 00:46:38 +01:00
parent 642ef8abb5
commit 1de317993f
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -619,13 +619,15 @@ function Add_Other_db_tables () {
}, function (data) {
var $newTableDom = $(data.message);
$newTableDom.find('a').first().remove();
$('#container-form').append($newTableDom);
enableTableEvents(null, $newTableDom);
addTableToTablesList(null, $newTableDom);
var dbEncoded = $($newTableDom).find('.small_tab_pref').attr('db_url');
var tableEncoded = $($newTableDom).find('.small_tab_pref').attr('table_name_url');
j_tabs[dbEncoded + '.' + tableEncoded] = 1;
MarkUnsaved();
if (typeof dbEncoded === 'string' && typeof tableEncoded === 'string' ) { // Do not try to add if attr not found !
$('#container-form').append($newTableDom);
enableTableEvents(null, $newTableDom);
addTableToTablesList(null, $newTableDom);
j_tabs[dbEncoded + '.' + tableEncoded] = 1;
MarkUnsaved();
}
});
$(this).dialog('close');
};