datatables 相关问题

DataTables是jQuery JavaScript库的插件。它是一个高度灵活的工具,基于渐进增强的基础,它将为任何HTML表添加高级交互控件。不要与[datatable]一起使用它。

如何从数据对象获取DataTable js中的图片url?

我有js DataTable来显示项目列表。 每个项目的属性和图像都很少。 我创建 js DataTable 来显示所有信息。 除了图像之外,一切正常。 通常图像是访问...

回答 1 投票 0

Inertia.js 未在删除路由上调用 onSuccess()

我有一个删除路由Inertia.js,这样当我删除一个项目时,它会重定向回我所在的页面。然而,这并不是在 Inertia destroy 路由中调用 onSuccess() 函数。 示例...

回答 2 投票 0

可使用 R Shiny 中的 CellEdit 动态选项编辑数据表行

这确实是一个普遍问题,所以我没有代表。使用 CellEdit,有谁知道如何用包含单个

回答 1 投票 0

jquery 数据表分页不起作用

我是 jquery 数据表的新手,我有一个简单的函数,它调用 ajax 并将响应映射到数据表中,该函数正在工作,但是分页无法正常工作,任何建议都会...

回答 3 投票 0

数据表打印导出选项中不包含数据表页脚

我正在使用 Codeigniter 和 ajax 请求与 DataTable 来获取数据,并尝试使用 DataTable 打印导出选项打印数据。但页脚没有出现在打印中。 我怎样才能包括...

回答 4 投票 0

fnGetData() 无法识别

有一个数据表: 有一个dataTable: <table id="list_details_livraison" class="striped cell-hovered border bordered" data-searching="true"> <thead> <tr> <th style="text-align: center;"><?php echo _getText('detaillivraison.entete.article');?></th> <th style="text-align: center;"><?php echo _getText('detaillivraison.entete.qtelivrer');?></th> <th style="text-align: center;"></th> </tr> </thead> <tbody> </tbody> </table> <script> $(document).ready(function() { var dt = $('#list_details_livraison').DataTable({ responsive: true, "oLanguage": { // switch lang here with a PHP variable "sUrl": "<?php echo RP_LANG ?>fr_FR.txt", }, "processing": true, "serverSide": true, ajax: "<?php echo RP_SSP ?>server_processing_details_livraisons.php?livc_code=<?php echo $data[0]['livc_code']; ?>", "aoColumnDefs": [ { "aTargets": [1], "mData": 1, "mRender": function (data, type, full) { return '<div style="text-align:center;">'+ data +'</div>'; } }, { "aTargets": [2], "mData": 2, "mRender": function (data, type, full) { if (isDetailLivraisonValider(data)) { return '<div style="text-align:center;">'+ '<span class="mif-checkmark mif-2x fg-lightGreen"></span>'+ '</div>'; } else { var article = '\''+full [1]+'\''; return '<div style="text-align:center;">'+ '<a href="../../RestaurantLivraison/modifierDetail/'+ data +'" style="margin-right: 8px;"><span class="mif-pencil mif-2x"></span></a>'+ '<a href="#" id="staticDialog" onclick="afficheDlg(\''+ data +'\','+article+')" style="color:red;"><span class="mif-cross mif-2x"></span></a>'+ '</div>'; } } }], "aLengthMenu": [[10, 25,50,100, -1], [10, 25,50,100, "Tout"]] }); var nb = dt.fnGetData().length; alert("number of rows = "+nb); }); </script> 在运行时没有警报显示,控制台显示“TypeError:dt.fnGetData 不是函数”! 如果我用 dataTable 替换 DataTable,那么虽然显示了 2 行,但返回结果却是 0!我使用的dataTable版本是1.10.6 那么有什么问题吗? 尝试: console.log(dt.fnGetData($('#list_details_livraison'))); 也尝试改变: var dt = $('#list_details_livraison').DataTable({ 至: var dt = $('#list_details_livraison').dataTable({ 1.10.6 fnGetData() 更改为 data() 函数。您可以在此处找到转换信息。 var lengthData= dt .rows() .data().length; 当数据表移至版本 1.10+ 时,匈牙利表示法更改为驼峰式大小写表示法 在你的情况下, fngetdata 更改为 row().data() https://datatables.net/reference/api/row().data() 这里是 1.9 到 1.10 升级说明的完整列表 https://datatables.net/upgrade/1.10-convert 就我而言,这是因为我在不存在的索引处配置了列。 示例: const DTable = table.DataTable({ columnDefs: [ { orderable: false, targets: [0] }, { orderable: false, targets: [2], className: 'editable' }, { orderable: false, targets: [6], // <--- Wrong index, my table only had 5 columns className: "no-select" } ], }) 将目标设置为targets: [4]为我解决了这个错误。

回答 4 投票 0

如何获取数据表中搜索框中输入的值

如何获取数据表中搜索框中输入的值。 有没有办法获取数据表中搜索框中输入的值?

回答 6 投票 0

更改窗口大小和在导航选项卡之间切换时,数据表无法正确调整大小

在我的网页中,我有一个带有两个选项卡的导航选项卡栏。每个选项卡都有一个单独的数据表。当我最初加载页面并在选项卡之间切换时,表格正确呈现。但是当我调整大小时...

回答 1 投票 0

数据表导出数据中缺少表单输入

我有这个Html: ... 我有这个Html: <div class="table-responsive"> <div id="product_purchase_report_table_wrapper" class="dataTables_wrapper form-inline dt-bootstrap"> <div class="dt-buttons btn-group"> <a class="btn btn-default buttons-csv buttons-html5 btn-sm" tabindex="0" aria-controls="product_purchase_report_table" href="#"> <span><i class="fa fa-file-csv" aria-hidden="true"></i> Export to CSV</span> </a> <a class="btn btn-default buttons-excel buttons-html5 btn-sm" tabindex="0" aria-controls="product_purchase_report_table" href="#"> <span><i class="fa fa-file-excel" aria-hidden="true"></i> Export to Excel</span> </a> <a class="btn btn-default buttons-print btn-sm" tabindex="0" aria-controls="product_purchase_report_table" href="#"> <span><i class="fa fa-print" aria-hidden="true"></i> Print</span> </a> <a class="btn btn-default buttons-collection buttons-colvis btn-sm" tabindex="0" aria-controls="product_purchase_report_table" href="#"> <span><i class="fa fa-columns" aria-hidden="true"></i> Column visibility</span> </a> <a class="btn btn-default buttons-pdf buttons-html5 btn-sm" tabindex="0" aria-controls="product_purchase_report_table" href="#"> <span><i class="fa fa-file-pdf" aria-hidden="true"></i> Export to PDF</span> </a> </div> <div id="product_purchase_report_table_filter" class="dataTables_filter"> <label><input type="search" class="form-control input-sm" placeholder="Search ..." aria-controls="product_purchase_report_table" /></label> </div> <table class="table table-bordered table-striped dataTable" id="product_purchase_report_table" role="grid" aria-describedby="product_purchase_report_table_info"> <thead> <tr role="row"> <th class="sorting_asc" tabindex="0" aria-controls="product_purchase_report_table" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Date: activate to sort column descending" style="width: 56.7656px;">Date</th> <th class="sorting" tabindex="0" aria-controls="product_purchase_report_table" rowspan="1" colspan="1" aria-label="Supplier: activate to sort column ascending" style="width: 386.305px;">Supplier</th> <th class="sorting" tabindex="0" aria-controls="product_purchase_report_table" rowspan="1" colspan="1" aria-label="Product: activate to sort column ascending" style="width: 104.383px;">Product</th> <th class="sorting" tabindex="0" aria-controls="product_purchase_report_table" rowspan="1" colspan="1" aria-label="Reference No.: activate to sort column ascending" style="width: 103.508px;">Reference No.</th> <th class="sorting" tabindex="0" aria-controls="product_purchase_report_table" rowspan="1" colspan="1" aria-label="Quantity: activate to sort column ascending" style="width: 62.1953px;">Quantity</th> <th class="sorting_disabled" rowspan="1" colspan="1" aria-label="PCs" style="width: 86.0312px;">PCs</th> <th class="sorting" tabindex="0" aria-controls="product_purchase_report_table" rowspan="1" colspan="1" aria-label="Unit Purchase Price: activate to sort column ascending" style="width: 142.883px;"> Unit Purchase Price </th> <th class="sorting" tabindex="0" aria-controls="product_purchase_report_table" rowspan="1" colspan="1" aria-label="Subtotal: activate to sort column ascending" style="width: 69.4141px;">Subtotal</th> <th class="sorting" tabindex="0" aria-controls="product_purchase_report_table" rowspan="1" colspan="1" aria-label="Average (Kgs) / Pc: activate to sort column ascending" style="width: 133.516px;">Average (Kgs) / Pc</th> </tr> </thead> <tbody> <tr role="row" class="odd"> <td class="sorting_1">02-10-2023</td> <td> mr Omar Salim Mwakuzinya - AUTO REPAIRS </td> <td>01. Whole Chicken</td> <td>5412</td> <td>1200</td> <td style="max-width: 70px !important;" class="mobile"> <div class="form-group"> <input class="form-control" value="0.00" name="pcs" type="number" id="pcs" data-code="55" data-value="0.00" style="width: 70px !important;" /> </div> </td> <td>300.00</td> <td>360,000.00</td> <td>0</td> </tr> <tr role="row" class="even"> <td class="sorting_1">02-10-2023</td> <td> mr Omar Salim Mwakuzinya - AUTO REPAIRS </td> <td>11. Gizzard</td> <td>5412</td> <td>3.5</td> <td style="max-width: 70px !important;" class="mobile"> <div class="form-group"> <input class="form-control" value="0.00" name="pcs" type="number" id="pcs" data-code="56" data-value="0.00" style="width: 70px !important;" /> </div> </td> <td>200.00</td> <td>700.00</td> <td>0</td> </tr> </tbody> <tfoot> <tr class="bg-gray font-17 footer-total text-center"> <td colspan="4" rowspan="1">Total:</td> <td rowspan="1" colspan="1">1449.06</td> <td rowspan="1" colspan="1">204</td> <td rowspan="1" colspan="1">297.00</td> <td rowspan="1" colspan="1">430,366.68</td> <td rowspan="1" colspan="1">&nbsp;</td> </tr> </tfoot> </table> <div class="dataTables_info" id="product_purchase_report_table_info" role="status" aria-live="polite">Showing 1 to 11 of 11 entries</div> <div class="dataTables_paginate paging_simple_numbers" id="product_purchase_report_table_paginate"> <ul class="pagination"> <li class="paginate_button previous disabled" id="product_purchase_report_table_previous"><a href="#" aria-controls="product_purchase_report_table" data-dt-idx="0" tabindex="0">Previous</a></li> <li class="paginate_button active"><a href="#" aria-controls="product_purchase_report_table" data-dt-idx="1" tabindex="0">1</a></li> <li class="paginate_button next disabled" id="product_purchase_report_table_next"><a href="#" aria-controls="product_purchase_report_table" data-dt-idx="2" tabindex="0">Next</a></li> </ul> </div> </div> </div> 这会产生这个数据表: 我的问题是,当我以任一方式(pdf、excel 等)导出数据时,表单输入数据(PC 列)为空白。我是否像其他列一样将输入导出为文本?我需要导出所有列,包括表单输入列。我正在使用 Datatables CDN 库 是的,这是可能的。 基本上,使用取自 Datatables 论坛 的这段代码: body: function ( data, row, column, node ) { return $(data).is("div") ? $(data).find('input').val(): data; }

回答 1 投票 0

查找 2 个数据表之间的重复项并将其删除

我有来自2个不同sql数据库的数据 我用数据创建了 2 个数据表 两个数据表中的列不相同 但我需要在两者的第一列中找到重复项并重新...

回答 1 投票 0

对数据表中两个特定列条目的值求和

我有以下数据表: dt.数据 <- structure(list(delivMonth = c("2024-04", "2024-04", "2024-04", "2024-04", "2024-04", "2024-04&...

回答 1 投票 0

数据表动态调整大小

我正在使用神奇的 DataTables jQuery 插件; http://datatables.net/ 添加了FixedColumns 和KeyTable 附加功能。 现在,当窗口大小更改时,表格的大小会相应调整。然而,...

回答 13 投票 0

如何在jquery中使用return来获取每行的data.id?

我有一个表,显示从 Jquery 中的 API 检索到的元素我想检索行的 ID 以添加删除或修改 $("#examplee").DataTable({ ...

回答 1 投票 0

datatables.net 与角度 ts

我正在使用 Angular 15,并且我有一个由 datatables.net 包创建的数据表。 每行都有一个按钮,单击它时,它会展开并显示一个包含该行更多详细信息的表单。 ...

回答 1 投票 0

Javascript 数据表可以显示原始/文字字符串而不是解释转义字符吗?

我构建了一个 Flask 应用程序,用于显示用户在 DataTable 中上传的 CSV 文件中的文本数据。有时,文本可能包含转义字符,甚至一些代码/标签。我想要所有文字

回答 1 投票 0

Jquery 数据表 Nodejs 服务器端渲染

我正在尝试使用 Nodejs 和 MSSQL 数据库后端为我的 jquery 数据表实现服务器端渲染。 这是我的客户端代码: 让 tblAssignedJobs = $('#tblAssignedJobs').DataTable(...

回答 1 投票 0

使用 NodeJS 和 MySql 的 jQuery 数据表

我想显示数据表中的值。我打开 chrome 开发工具并转到网络选项卡 XHR,问题是,响应是一个 HTML 文档 服务器端代码: router.get('/agents', ...

回答 3 投票 0

错误ajax错误-数据表警告:表id-示例

我单击“确定”并在控制台中出现错误: 我是编程新手,我需要帮助。我需要使用 json 从多个数据结构形成数据表。此时,我陷入了这个错误。请帮忙

回答 3 投票 0

如何向 highcharts 添加其他参数以从数据表中提取数据?

我正在使用数据表和高图。当用户单击按钮 2023、2022 和 ABC 按钮时,图表会重新加载并向用户提供动画效果。一切都很好。不过,我还有一些

回答 1 投票 0

如何在 Laravel 7 中显示 Yajra 数据表中的数据?

我想使用 Yajra Datatables 在 Laravel 中显示数据,但问题是数据还无法同步。 如果我执行 Dump and Die dd($orders),显示的数据数量是 4,但如果我显示...

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.