disable col alias when asterisk choosen for column
Signed-off-by: faissaloux <fwahabali@gmail.com>
This commit is contained in:
parent
da10e0b19b
commit
5fb7565d25
@ -22,6 +22,9 @@ AJAX.registerTeardown('database/multi_table_query.js', function () {
|
||||
$('.tableNameSelect').each(function () {
|
||||
$(this).off('change');
|
||||
});
|
||||
$('.columnNameSelect').each(function () {
|
||||
$(this).off('change');
|
||||
});
|
||||
$('#update_query_button').off('click');
|
||||
$('#add_column_button').off('click');
|
||||
});
|
||||
@ -162,14 +165,27 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
addNewColumnCallbacks();
|
||||
});
|
||||
|
||||
$('.columnNameSelect').each(function () {
|
||||
$(this).on('change', function () {
|
||||
const colIsStar = $(this).val() === '*';
|
||||
|
||||
colIsStar && $(this).siblings('.col_alias').val('');
|
||||
$(this).siblings('.col_alias').prop('disabled', colIsStar);
|
||||
});
|
||||
});
|
||||
|
||||
function addNewColumnCallbacks () {
|
||||
$('.tableNameSelect').each(function () {
|
||||
$(this).on('change', function () {
|
||||
var $sibs = $(this).siblings('.columnNameSelect');
|
||||
const $alias = $(this).siblings('.col_alias');
|
||||
|
||||
if ($sibs.length === 0) {
|
||||
$sibs = $(this).parent().parent().find('.columnNameSelect');
|
||||
}
|
||||
|
||||
$sibs.first().html($('#' + $(this).find(':selected').data('hash')).html());
|
||||
$alias.prop('disabled', true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user