fix: [index] search fixed

- correctly persist url parameters when searching
pull/38/head
iglocska 2021-01-13 14:23:11 +01:00
parent d6bef47ce9
commit 1a1a7b9107
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 11 additions and 2 deletions

View File

@ -43,14 +43,23 @@
$(document).ready(function() { $(document).ready(function() {
var controller = '<?= $this->request->getParam('controller') ?>'; var controller = '<?= $this->request->getParam('controller') ?>';
var action = '<?= $this->request->getParam('action') ?>'; var action = '<?= $this->request->getParam('action') ?>';
var additionalUrlParams = '';
<?php
if (!empty($data['additionalUrlParams'])) {
echo sprintf(
'additionalUrlParams = \'/%s\';',
h($data['additionalUrlParams'])
);
}
?>
var randomValue = '<?= h($tableRandomValue) ?>'; var randomValue = '<?= h($tableRandomValue) ?>';
$('#quickFilterButton-' + randomValue).click(function() { $('#quickFilterButton-' + randomValue).click(function() {
var url = '/' + controller + '/' + action + '?quickFilter=' + encodeURIComponent($('#quickFilterField-<?= h($tableRandomValue) ?>').val()); var url = '/' + controller + '/' + action + additionalUrlParams + '?quickFilter=' + encodeURIComponent($('#quickFilterField-<?= h($tableRandomValue) ?>').val());
executePagination(randomValue, url); executePagination(randomValue, url);
}); });
$('#quickFilterField').on('keypress', function (e) { $('#quickFilterField').on('keypress', function (e) {
if(e.which === 13) { if(e.which === 13) {
var url = '/' + controller + '/' + action + '?quickFilter=' + encodeURIComponent($('#quickFilterField-<?= h($tableRandomValue) ?>').val()); var url = '/' + controller + '/' + action + additionalUrlParams + '?quickFilter=' + encodeURIComponent($('#quickFilterField-<?= h($tableRandomValue) ?>').val());
executePagination(randomValue, url); executePagination(randomValue, url);
} }
}); });