Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/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
Jquery 如何在数据更改时突出显示制表器中的单个单元格_Jquery_Tabulator - Fatal编程技术网

Jquery 如何在数据更改时突出显示制表器中的单个单元格

Jquery 如何在数据更改时突出显示制表器中的单个单元格,jquery,tabulator,Jquery,Tabulator,我试图使用jQuery.effect()函数在从服务器刷新制表器数据时突出显示其中的更改 我仍然在使用Tabletor 3.5,所以我认为jQuery.effect()是最简单的方法。只要达到预期效果,就不强制使用 我尝试在表中设置一个简单的计数器,在该计数器中,值在更改时高亮显示(还没有ajax),但只能高亮显示整行、整列或整行和整列,而不是特定的单元格 var i = 1; var timer = setInterval(function(){ if(i<=5){

我试图使用jQuery.effect()函数在从服务器刷新制表器数据时突出显示其中的更改

我仍然在使用Tabletor 3.5,所以我认为jQuery.effect()是最简单的方法。只要达到预期效果,就不强制使用

我尝试在表中设置一个简单的计数器,在该计数器中,值在更改时高亮显示(还没有ajax),但只能高亮显示整行、整列或整行和整列,而不是特定的单元格

var i = 1;
var timer = setInterval(function(){
    if(i<=5){
        var id = 12345;
        var row = $("#live-table").tabulator("getRow", id);

        // Manually updated for now - from ajax later
        $("#live-table").tabulator("updateData", [{playerId:id, blah:i}]);

        // Successfully highlights the col on value change
        $("#live-table .tabulator-cell[tabulator-field=blah]").effect( "highlight",{color: '#329cff'},3000);
        // Successfully highlights the row on value change
        $("#live-table .tabulator-row:nth-child(1)").effect( "highlight",{color: '#329cff'},3000);

        i++;
    }else{
        clearInterval(timer);
        console.log("cleared");
    }
}, 3000); 
var i=1;
var timer=setInterval(函数(){

如果(i我已使用以下代码解决了问题。计时器中的计数器将在完全实现时被更长的间隔和数据库查询所取代,显然不需要实现更改数据的突出显示。注意:制表器版本3.5

var i = 1;
var timer = setInterval(function(){
    if(i<=5){
        var id = 12345;
        var row = $("#live-table").tabulator("getRow", id);
        var cell = row.getCell("blah");
        // Manually updated for now - from ajax DB query later
        $("#live-table").tabulator("updateData", [{playerId:id, blah:i}]);
        cell.getElement().effect( "highlight",{color: '#329cff'},3000);
        i++;
    }else{
        clearInterval(timer);
    }
}, 3000); 

var i=1;
var timer=setInterval(函数(){

如果(i您也可以在制表器回调中使用此简单方法。更新数据后,在特定单元格上调用触发器函数以访问cellEdited():

Javascript

cellEdited:function(cell){             
cell.getElement().style.color= "#ffffff";              //CHANGE CELL WHITE FONT
cell.getElement().style.backgroundColor = "#e68a00";   //CHANGE CELL GOLD COLOR
}


您是否尝试过使用
rowUpdated
回调?这里有更多信息:感谢您的提示。我将查看
rowUpdated
和其他类似回调,以了解何时突出显示更改,但是这个问题特别是关于突出显示单个单元格。另外@dota2pro,感谢setInterval链接。它看起来就像我会根据你指给我的答案正确地使用它,因为它说:如果你用它来做一些应该每x毫秒做一次的事情,那么你是正确地使用它的…因为我每x毫秒用它来更新我的表数据并突出显示任何更改,看来我最终还是会得到你的祝福继续。谢谢唉!如果你在4.2.7退出的时候使用3.5,我认为setInterval是最好的方法,你不需要我有用的评论谢谢!现在要改变一切,使其在没有原始jQuerey依赖项的情况下工作太难了/没有时间了…这就是坚持使用旧版本的原因。这就是我的观点,setInterval代码不是可移植。作为tablator对象中的回调,我直到3天前才使用setInterval,在此之前,我仍然不值得花时间更新到v4+。那么,您如何建议以特定的预定义间隔刷新表数据?