Я пытаюсь сделать вызов Ajax для Datatable Serverside с Typo3 Extbase Controller для внешнего интерфейса, но не может получить данные в таблице, вместо этого только следующий вывод :Ajax вызов для Datatables Serverside с функцией Typo3 Extbase Controller
{"sEcho":0,"iTotalRecords":"6","iTotalDisplayRecords":"6","aaData":[["1","Hans","Meier","51","2011-04-13","EUR200"],["2","Frank","Heinz","45","2004-02-17","EUR60"],["3","Katrin","Kohl","35","2011-08-17","EUR1000"],["4","Werner","Pertl","39","2013-11-19","USD499"],["5","Christina","Sinn","22","2015-03-09","GBP99"],["6","Klaus","Vienna","67","1991-01-15","EUR5000"]]}
Я использую следующий вид (list.html):
<f:layout name="Default" />
<f:section name="main">
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Field 1</th>
<th>Field 2</th>
<th>Field 3</th>
<th>Field 4</th>
<th>Field 5</th>
<th>Field 6</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Field 1</th>
<th>Field 2</th>
<th>Field 3</th>
<th>Field 4</th>
<th>Field 5</th>
<th>Field 6</th>
</tr>
</tfoot>
</table>
<script type="text/javascript" src="typo3conf/ext/ffs_datatables/Resources/Public/ajaxFunctions.js"></script>
</f:section>
Моя JS функция (ajaxFunctions.js) используется:
var MY_AJAX_ACTION_URL = '<f:uri.action action="list" controller="DatatableController" pageType="5000" />';
$(document).ready(function() {
$('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": {
type: 'POST',
url: MY_AJAX_ACTION_URL
}
});
});
.. и на мой контроллер:
namespace myVendor\FfsDatatables\Controller;
/**
* DatatableController
*/
class DatatableController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
/**
* action list
*
* @return void
*/
public function listAction() {
... и я в том числе следующий синтаксис из: https://datatables.net/development/server-side/php_mysql здесь и обменен эхо с возвращением ...
return json_encode($output);
}
/**
* action
*
* @return void
*/
public function Action() {
}
}
TypoScript используется:
ajaxCall = PAGE
ajaxCall {
typeNum = 5000
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/json
xhtml_cleaning = 0
admPanel = 0
debug = 0
no_cache = 1
}
}
Что мне не хватает или что-то не так?
Вы также можете использовать eID-вызов http://stackoverflow.com/questions/21139769/typo3-extbase-ajax-without-page-typenum#32225730 –