Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/393.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
Javascript 使用Datatables修改TableTools_Javascript_Datatables_Jquery Datatables - Fatal编程技术网

Javascript 使用Datatables修改TableTools

Javascript 使用Datatables修改TableTools,javascript,datatables,jquery-datatables,Javascript,Datatables,Jquery Datatables,我试图找出如何在复制按钮之前添加一个按钮,该按钮始终是指向资源的创建页面的链接。因此,如果它在/users上,并且在按钮列表中,如果用户单击Add,那么它将转到/users/create。我将如何使用下面的代码实现这一点。我也有几个错误,并研究了它,发现我的错误可能是由于我的文件渲染顺序。我已将订单包括在下面。我希望有人能帮助我 TypeError: jQuery[g3g][((((Y2 + Z3) + G4) + p1) + F9e)] is undefined ...((Y2+G4+d6

我试图找出如何在复制按钮之前添加一个按钮,该按钮始终是指向资源的创建页面的链接。因此,如果它在/users上,并且在按钮列表中,如果用户单击Add,那么它将转到/users/create。我将如何使用下面的代码实现这一点。我也有几个错误,并研究了它,发现我的错误可能是由于我的文件渲染顺序。我已将订单包括在下面。我希望有人能帮助我

TypeError: jQuery[g3g][((((Y2 + Z3) + G4) + p1) + F9e)] is undefined


...((Y2+G4+d6g+Z3+G4+A1e+U2+y8g))):jQuery&&!jQuery[g3g][(Y2+Z3+G4+p1+F9e)][(y8+t5e+...


dataTab...itor.js (line 475, col 170)
TypeError: DataTable.Editor is undefined


DataTable.Editor.defaults.display = "bootstrap";

editor....trap.js (line 8)


$('document').ready(function() {
    $('#myDatatable').dataTable({
        "pagingType": "full_numbers",
        "aoColumnDefs": [
            { 'bSortable': false, 'aTargets': [-1] },
            { 'sWidth': '30px', 'aTargets': ['idTH'] },
            { 'sWidth': '150px', 'aTargets': ['actionsTH', 'subTH'] },
            { 'sClass': 'text-center', 'aTargets': ['idTH', 'actionsTH', 'subTH'] }
        ],
        "iDisplayLength": 10,
        "aLengthMenu": [
            [5, 10, 25, 50, -1],
            [5, 10, 25, 50, "All"]
        ],
        dom: '<"dt-panelmenu clearfix"Tfr>t<"dt-panelfooter clearfix"ip>',
        "oTableTools": {
            "sSwfPath": "vendor/plugins/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf"
        }
    });
});

<script src="http://myapp.app/vendor/jquery/jquery-1.11.1.min.js">
<script src="http://myapp.app/vendor/jquery/jquery_ui/jquery-ui.min.js">
<script src="http://myapp.app/assets/js/bootstrap/bootstrap.min.js">
<script src="http://myapp.app/assets/js/utility/utility.js">
<script src="http://myapp.app/assets/js/main.js">
<script type="text/javascript">
<script src="http://myapp.app/vendor/plugins/datatables/media/js/jquery.dataTables.js">
<script src="http://myapp.app/vendor/plugins/datatables/media/js/dataTables.bootstrap.js">
<script src="http://myapp.app/vendor/plugins/datatables/extensions/TableTools/js/dataTables.tableTools.min.js">
<script src="http://myapp.app/vendor/plugins/datatables/extensions/Editor/js/dataTables.editor.js">
<script src="http://myapp.app/vendor/plugins/datatables/media/js/dataTables.bootstrap.js">
<script src="http://myapp.app/vendor/plugins/datatables/extensions/Editor/js/editor.bootstrap.js">
<script src="http://myapp.app/assets/js/my-datatables.js">
TypeError:jQuery[g3g][((Y2+Z3)+G4)+p1)+F9e]未定义
…((Y2+G4+d6g+Z3+G4+A1e+U2+y8g)):jQuery&&!jQuery[g3g][(Y2+Z3+G4+p1+F9e)][(y8+t5e+。。。
dataTab…itor.js(第475行,第170列)
TypeError:DataTable.Editor未定义
DataTable.Editor.defaults.display=“bootstrap”;
编辑器…trap.js(第8行)
$('document').ready(函数(){
$(“#myDatatable”).dataTable({
“pagingType”:“完整编号”,
“aoColumnDefs”:[
{'bSortable':false,'aTargets':[-1]},
{'sWidth':'30px','aTargets':['idTH']},
{'sWidth':'150px','aTargets':['actionsTH','subTH']},
{'sClass':'text center','aTargets':['idTH','actionsTH','subTH']}
],
“iDisplayLength”:10,
“阿伦哲努”:[
[5, 10, 25, 50, -1],
[5,10,25,50,“全部”]
],
dom:‘t’,
“可旋转工具”:{
“sSwfPath”:“供应商/plugins/datatables/extensions/TableTools/swf/copy\u csv\u xls\u pdf.swf”
}
});
});
首先,在您的
标记部分,您打开了一个标记,但从未关闭它。这可能是您没有定义的奇怪错误。与其说是脚本的位置或顺序,不如说是脚本的位置

至于在UI中添加按钮,有时datatables解释的方式并不总是对您有利,因为这些按钮是基于flash的

为了举例,我要说: 调用
$('#myDatatable').dataTable({});

只需通过标准jquery方法附加元素

即:

$('#myDatatable')。追加('Hello');
同样,主要是为了举例,您可以根据需要进行调整,但您基本上可以将其紧贴在按钮旁边。如果您愿意,您可能会将其放入按钮容器中,但随后您会弄乱额外的样式、定位等。如果您对整个事物有感觉,则最容易将其放在旁边。

som我更新了我的帖子,因为我仍然不确定如何处理上述问题。
$('#myDatatable').append('<div style="width:100px;height:30px;background-color:#F60;color:#fff;position:absolute;top:2px;right:275px;">Hello</div>');