dataTable fn更新带有新值的行

编程入门 行业动态 更新时间:2024-10-19 19:27:37
本文介绍了dataTable fn更新带有新值的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用数据表,并在表格中有这个tr元素

I im using Datatables and have this tr element in table

<tr class="gradeA even row_selected" id="3692"> <td class=" sorting_1">3692</td> <td class="">koza</td> <td class="" title="10:12:30">2013-12-31</td> <td class="">2014-02-06</td> <td class="">FULL packet</td> <td class="">NONE</td> <td class="">Name</td>

,并希望更新1st和使用fnUpdate函数的第4个td元素。我已经尝试更新只有一个td,但它不更新。在chrome,控制台日志中我收到这个错误:

and would like to update 1st and 4th td element using fnUpdate function. I have tried to update for only one td but it does not update. in chrome, console log I am getting this error:

Uncaught TypeError: Cannot set property '_aData' of undefined

这是我试过的:

// dynamically update row $('#example').dataTable().fnUpdate( ['Zebra'], parseInt('3692'));

3692是td元素的id,用于知道我需要更新哪一行,斑马是价值改变。我知道我没有包括哪个单元格更新,但是我不知道该怎么做。在数据表api中,给出以下示例:

3692 is the id of the td element to know which row I need to update, and the zebra is the value to change. I know that I have not included which cell to update but I don't know how to do that. On datatables api, following example is given:

oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1 ); // Row

欢迎任何帮助。

谢谢。

推荐答案

请在这里查看文档 datatables/api

您的问题尚未完成,因为您需要指定要修改的列(td),但是这是我会尝试的(假设你想更新第二列)。

Your question is not complete, as you need to specify what column(td) you want to modify, but here's what I would try (assuming you want to update the second column).

$('#example')。dataTable()。fnUpdate ('Zebra',$('tr#3692')[0],1);

第二个参数将是行,而第三个是列。

The second parameter will be the row, and the third is the column.

请注意,我传递了一个字符串。

Note that I passed in a string.

更多推荐

dataTable fn更新带有新值的行

本文发布于:2023-10-26 23:42:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1531686.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:dataTable   fn

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!