Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Datatables TYPO3-通过javascript将extbase viewhelper添加到部分_Datatables_Typo3_Typo3 Extensions_Typo3 8.x_Typo3 8.7.x - Fatal编程技术网

Datatables TYPO3-通过javascript将extbase viewhelper添加到部分

Datatables TYPO3-通过javascript将extbase viewhelper添加到部分,datatables,typo3,typo3-extensions,typo3-8.x,typo3-8.7.x,Datatables,Typo3,Typo3 Extensions,Typo3 8.x,Typo3 8.7.x,我有一部分。。。如果我通过link.action添加链接。。。该链接运行良好: MyPartial.html: <f:link.action action="show" pageUid="43" pluginName="abc" controller="Abc" extensionName="abc" arguments="{record:1}">ActionLink</f:link.action> ActionLink 但是如果我想通过Javascript将link

我有一部分。。。如果我通过link.action添加链接。。。该链接运行良好:

MyPartial.html:

<f:link.action action="show" pageUid="43" pluginName="abc" controller="Abc" extensionName="abc" arguments="{record:1}">ActionLink</f:link.action>
ActionLink
但是如果我想通过Javascript将link.page viewhelper添加到部分页面中

MyPartial.html

  <table id="lei_all" width="100%">
    <thead>
      <tr>
        <th>Column01</th>
        <th>Column02</th>
      </tr>
    </thead>
  </table>      

专栏01
专栏02
JS:

var table_all=$('#table_all')。数据表({
dom:“Blrtip”,
阿贾克斯:{
url:“/source.php”,
类型:“职位”
},
服务器端:是的,
处理:对,
栏目:[
{数据:“第01列”,
“渲染”:函数(数据、类型、行){
返回“”+数据+“”;
} },
{数据:“第02列”}
],
...
} );      
我得到的原始视图辅助对象如下所示:

<tbody>
    <tr id=row_1 class="odd" role="row">
        <td tabindex="0"><f:link.action action="show" pageUid="43" pluginName="abc" controller="Abc" extensionName="abc" arguments="{record:1}">ActionLink</f:link.action></td>     
        ...
    </tr>
</tbody>    

ActionLink
...

在上述情况下,如何添加viewhelper

ViewHelper根本就不是这样工作的。您所尝试的相当于在JavaScript中调用PHP函数来构建字符串。这样做的预期结果是,您将看到流体标记输出,与您描述的完全相同

唯一的方法是用PHP构建链接并(以某种方式)将它们传输到JavaScript。有效的方法包括:

  • 使用
    data something
    属性将URL从HTML传送到JS
  • 使用XHR请求为特定目的创建链接
  • 生成所有链接的列表,按照表中的标识符进行索引,如JSON或其他文件,例如
    typo3temp
    ,然后在JS中呈现表时读取此列表并使用适当的链接

根据您的需要,选择一个并实现它,这样您的JavaScript中就不会有流畅的代码。

在我看来,缺少一个正确的结束标记。这是一个复制粘贴错误。。。正如你现在所看到的,它正确地关闭了。谢谢你的解释。我的问题是表的API不是来自类型3。。。它是外部的。但我确实想链接一张唱片的详细资料。但如果它是一个新记录,其中还没有创建realurl链接。。。详细记录不可用。因此,我希望通过link.action“show”(如果不可用,它将创建realurl链接)使用该链接。你有什么建议我能做到这一点吗?你必须查阅你正在使用的远程API的文档,然后考虑如何用上面一种生成URL的方法来连接。我修改了答案,加入了生成URL的第三个选项。
<tbody>
    <tr id=row_1 class="odd" role="row">
        <td tabindex="0"><f:link.action action="show" pageUid="43" pluginName="abc" controller="Abc" extensionName="abc" arguments="{record:1}">ActionLink</f:link.action></td>     
        ...
    </tr>
</tbody>