diff --git a/typo3/sysext/recycler/Classes/Controller/RecyclerAjaxController.php b/typo3/sysext/recycler/Classes/Controller/RecyclerAjaxController.php index 16e65cad431cf26a6b2aa8c76c154c1c495ea224..7a27973dbc537bdc563ebd77f6ee24295a685ef5 100644 --- a/typo3/sysext/recycler/Classes/Controller/RecyclerAjaxController.php +++ b/typo3/sysext/recycler/Classes/Controller/RecyclerAjaxController.php @@ -46,7 +46,7 @@ class RecyclerAjaxController { $this->conf['action'] = GeneralUtility::_GP('action'); $this->conf['table'] = GeneralUtility::_GP('table') ? GeneralUtility::_GP('table') : ''; $this->conf['limit'] = GeneralUtility::_GP('limit') ? (int)GeneralUtility::_GP('limit') : 25; - $this->conf['start'] = GeneralUtility::_GP('start') ? (int)GeneralUtility::_GP('limit') : 0; + $this->conf['start'] = GeneralUtility::_GP('start') ? (int)GeneralUtility::_GP('start') : 0; $this->conf['filterTxt'] = GeneralUtility::_GP('filterTxt') ? GeneralUtility::_GP('filterTxt') : ''; $this->conf['startUid'] = GeneralUtility::_GP('startUid') ? (int)GeneralUtility::_GP('startUid') : 0; $this->conf['depth'] = GeneralUtility::_GP('depth') ? (int)GeneralUtility::_GP('depth') : 0; @@ -101,17 +101,17 @@ class RecyclerAjaxController { $view->assign('records', $recordsArray['rows']); $view->assign('allowDelete', $allowDelete); $view->assign('total', $recordsArray['total']); - $content = json_encode(array( + $content = array( 'rows' => $view->render(), 'totalItems' => $recordsArray['total'] - )); + ); break; case 'undoRecords': if (empty($this->conf['records']) || !is_array($this->conf['records'])) { - $content = json_encode(array( + $content = array( 'success' => FALSE, 'message' => LocalizationUtility::translate('flashmessage.delete.norecordsselected', 'recycler') - )); + ); break; } @@ -120,17 +120,17 @@ class RecyclerAjaxController { $success = $model->undeleteData($this->conf['records'], $this->conf['recursive']); $affectedRecords = count($this->conf['records']); $messageKey = 'flashmessage.undo.' . ($success ? 'success' : 'failure') . '.' . ($affectedRecords === 1 ? 'singular' : 'plural'); - $content = json_encode(array( + $content = array( 'success' => TRUE, 'message' => sprintf(LocalizationUtility::translate($messageKey, 'recycler'), $affectedRecords) - )); + ); break; case 'deleteRecords': if (empty($this->conf['records']) || !is_array($this->conf['records'])) { - $content = json_encode(array( + $content = array( 'success' => FALSE, 'message' => LocalizationUtility::translate('flashmessage.delete.norecordsselected', 'recycler') - )); + ); break; } @@ -139,13 +139,14 @@ class RecyclerAjaxController { $success = $model->deleteData($this->conf['records']); $affectedRecords = count($this->conf['records']); $messageKey = 'flashmessage.delete.' . ($success ? 'success' : 'failure') . '.' . ($affectedRecords === 1 ? 'singular' : 'plural'); - $content = json_encode(array( + $content = array( 'success' => TRUE, 'message' => sprintf(LocalizationUtility::translate($messageKey, 'recycler'), $affectedRecords) - )); + ); break; } - $ajaxObj->addContent($this->conf['table'] . '_' . $this->conf['start'], $content); + $ajaxObj->setContentFormat('json'); + $ajaxObj->setContent($content); } /** diff --git a/typo3/sysext/recycler/Classes/Domain/Model/Tables.php b/typo3/sysext/recycler/Classes/Domain/Model/Tables.php index 827d9a17c0bc86ef8af6e833a884d52cc4a9b76f..108a6d9f44065f2230a111d22b58a8a04bad45c0 100644 --- a/typo3/sysext/recycler/Classes/Domain/Model/Tables.php +++ b/typo3/sysext/recycler/Classes/Domain/Model/Tables.php @@ -62,8 +62,7 @@ class Tables { $deletedRecordsTotal, $lang->sL('LLL:EXT:recycler/mod1/locallang.xlf:label_alltables') )); - $output = json_encode($jsonArray); - return $output; + return $jsonArray; } /** diff --git a/typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js b/typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js index ee97b44123a1badbef887083823db919de5d9af7..c2fb5601b4b7ddf2705d817ccfd84c2503a46e0b 100644 --- a/typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js +++ b/typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js @@ -89,6 +89,7 @@ define(['jquery', 'nprogress'], function($, NProgress) { // changing "table" Recycler.elements.$tableSelector.on('change', function() { + Recycler.paging.currentPage = 1; Recycler.loadDeletedElements(); }); @@ -480,6 +481,7 @@ define(['jquery', 'nprogress'], function($, NProgress) { if (Recycler.paging.totalPages === 1) { // early abort if only one page is available + Recycler.elements.$paginator.contents().remove(); return; } @@ -515,7 +517,7 @@ define(['jquery', 'nprogress'], function($, NProgress) { } $ul.append($controlFirstPage, liElements, $controlLastPage); - Recycler.elements.$paginator.contents().replaceWith($ul); + Recycler.elements.$paginator.html($ul); }; /**