chg: [element:generic_index] Usage of UI factory for group_search

pull/37/head
mokaddem 2021-01-15 12:12:55 +01:00
parent e1a39c2b01
commit 0ff8655fb3
2 changed files with 15 additions and 15 deletions

View File

@ -53,15 +53,23 @@
}
?>
var randomValue = '<?= h($tableRandomValue) ?>';
$('#quickFilterButton-' + randomValue).click(function() {
var url = '/' + controller + '/' + action + additionalUrlParams + '?quickFilter=' + encodeURIComponent($('#quickFilterField-<?= h($tableRandomValue) ?>').val());
executePagination(randomValue, url);
$(`#quickFilterButton-${randomValue}`).click(() => {
doFilter($(this))
});
$('#quickFilterField-' + randomValue).on('keypress', function (e) {
$(`#quickFilterField-${randomValue}`).on('keypress', (e) => {
if(e.which === 13) {
var url = '/' + controller + '/' + action + additionalUrlParams + '?quickFilter=' + encodeURIComponent($('#quickFilterField-<?= h($tableRandomValue) ?>').val());
executePagination(randomValue, url);
const $button = $(this).parent().find(`#quickFilterButton-${randomValue}`)
doFilter($button)
}
});
function doFilter($button) {
const encodedFilters = encodeURIComponent($(`#quickFilterField-${randomValue}`).val())
const url = `/${controller}/${action}${additionalUrlParams}?quickFilter=${encodedFilters}`
UI.reload(url, $(`#table-container-${randomValue}`), $(`#table-container-${randomValue} table.table`), [{
node: $button,
config: {}
}])
}
});
</script>

View File

@ -1,13 +1,5 @@
function executePagination(randomValue, url) {
var target = '#table-container-' + randomValue
$.ajax({
dataType:"html",
cache: false,
success:function (data, textStatus) {
$(target).html(data);
},
url:url,
});
UI.reload(url, $(`#table-container-${randomValue}`), $(`#table-container-${randomValue} table.table`))
}
function executeStateDependencyChecks(dependenceSourceSelector) {