0
我試圖與一個TYPO3的Extbase控制器Ajax調用的數據表Serverside集團的前端插件,但在表中不能得到的數據,而不是隻有下面的輸出:使用Ajax調用的數據表Serverside集團與TYPO3的Extbase控制器功能
<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):
{"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)
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() {
}
}
Typo腳本中使用:
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 –