Merge: #16249 Fixes: #16248 Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
commit
5c61a51351
@ -151,7 +151,7 @@ function checkForCheckbox (multiEdit) {
|
||||
|
||||
// used in Search page mostly for INT fields
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function verifyAfterSearchFieldChange (index) {
|
||||
function verifyAfterSearchFieldChange (index, searchFormId) {
|
||||
var $thisInput = $('input[name=\'criteriaValues[' + index + ']\']');
|
||||
// validation for integer type
|
||||
if ($thisInput.data('type') === 'INT') {
|
||||
@ -159,8 +159,9 @@ function verifyAfterSearchFieldChange (index) {
|
||||
$thisInput.val($thisInput.val().trim());
|
||||
|
||||
var hasMultiple = $thisInput.prop('multiple');
|
||||
|
||||
if (hasMultiple) {
|
||||
$('#tbl_search_form').validate();
|
||||
$(searchFormId).validate();
|
||||
// validator method for IN(...), NOT IN(...)
|
||||
// BETWEEN and NOT BETWEEN
|
||||
jQuery.validator.addMethod('validationFunctionForMultipleInt', function (value) {
|
||||
@ -170,7 +171,7 @@ function verifyAfterSearchFieldChange (index) {
|
||||
);
|
||||
validateMultipleIntField($thisInput, true);
|
||||
} else {
|
||||
$('#tbl_search_form').validate();
|
||||
$(searchFormId).validate();
|
||||
validateIntField($thisInput, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,6 +129,17 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
|
||||
searchedData = null;
|
||||
}
|
||||
|
||||
// adding event listener on select after AJAX request
|
||||
var comparisonOperatorOnChange = function () {
|
||||
var tableRows = $('#inputSection select.column-operator');
|
||||
$.each(tableRows, function (index, item) {
|
||||
$(item).on('change', function () {
|
||||
// eslint-disable-next-line no-undef
|
||||
changeValueFieldType(this, index);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
** Input form submit on field change
|
||||
**/
|
||||
@ -153,6 +164,7 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
|
||||
$('#types_0').val(data.field_type);
|
||||
xType = data.field_type;
|
||||
$('#collations_0').val(data.field_collations);
|
||||
comparisonOperatorOnChange();
|
||||
Functions.addDateTimePicker();
|
||||
});
|
||||
});
|
||||
@ -177,6 +189,7 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
|
||||
$('#types_1').val(data.field_type);
|
||||
yType = data.field_type;
|
||||
$('#collations_1').val(data.field_collations);
|
||||
comparisonOperatorOnChange();
|
||||
Functions.addDateTimePicker();
|
||||
});
|
||||
});
|
||||
@ -198,6 +211,7 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
|
||||
$('#tableFieldsId').find('tr:eq(4) td:eq(3)').html(data.field_value);
|
||||
$('#types_2').val(data.field_type);
|
||||
$('#collations_2').val(data.field_collations);
|
||||
comparisonOperatorOnChange();
|
||||
Functions.addDateTimePicker();
|
||||
});
|
||||
});
|
||||
@ -219,6 +233,7 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
|
||||
$('#tableFieldsId').find('tr:eq(5) td:eq(3)').html(data.field_value);
|
||||
$('#types_3').val(data.field_type);
|
||||
$('#collations_3').val(data.field_collations);
|
||||
comparisonOperatorOnChange();
|
||||
Functions.addDateTimePicker();
|
||||
});
|
||||
});
|
||||
|
||||
@ -979,7 +979,9 @@ class SearchController extends AbstractController
|
||||
$type = 'INT';
|
||||
}
|
||||
|
||||
$html_attributes .= " onchange= 'return verifyAfterSearchFieldChange(" . $column_index . ")'";
|
||||
$searchFormId = $this->_searchType === 'zoom' ? '#zoom_search_form' : '#tbl_search_form';
|
||||
|
||||
$html_attributes .= ' onchange="return verifyAfterSearchFieldChange(' . $column_index . ', \'' . $searchFormId . '\')"';
|
||||
|
||||
$value = $this->template->render('table/search/input_box', [
|
||||
'str' => '',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user