使用Datatables插件查找和替换单元格值 [英] Find and replace cells value with Datatables plugin

查看:62
本文介绍了使用Datatables插件查找和替换单元格值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用名为Datatables的插件查找并替换已知列中的特定值。

i'm looking to find and replace specific values from a known column with the plugin called Datatables.

这是我的代码:

table.columns(5).search('valuetochange').cells().every( function () {
  this.data('newvalue');
});

但它不起作用,我也试过其他解决方案但我没有找到更新单元格的方法。

But it is not working, I also tried other solutions but I didn't find a way to update the cells.

感谢您的帮助

推荐答案

我没有使用过搜索方法,但是这肯定会起作用

I have not used search method but alternatively this will definitely work

table.column(5).nodes().each(function (node, index, dt) {
  if(table.cell(node).data() == valuetochange){
    table.cell(node).data('100');
  }
});

这是一个演示 JsFiddle

Here is a demo JsFiddle

这篇关于使用Datatables插件查找和替换单元格值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆