Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/462.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函数分配给使用php呈现的制表器格式化程序?_Javascript_Php_Tabulator - Fatal编程技术网

如何将javascript函数分配给使用php呈现的制表器格式化程序?

如何将javascript函数分配给使用php呈现的制表器格式化程序?,javascript,php,tabulator,Javascript,Php,Tabulator,我正在使用php创建制表器列定义数组,我想分配一个javascript函数。 这不起作用: array_push($row2['formatter']='function(cell, formatterParams){var pType = cell.getValue();if(pType == "Patient"){cell.getElement().style.background = "yellow";}return pType;}'); 我可以在使用客户端javascript后将函数分

我正在使用php创建制表器列定义数组,我想分配一个javascript函数。 这不起作用:

array_push($row2['formatter']='function(cell, formatterParams){var pType = cell.getValue();if(pType == "Patient"){cell.getElement().style.background = "yellow";}return pType;}');
我可以在使用客户端javascript后将函数分配给数组。 这项工作:

tdata[0][1]['formatter']=function(cell, formatterParams){var pType = cell.getValue();if(pType == "Patient"){cell.getElement().style.background = "yellow";}return pType;};

如果您能用php在服务器端提供帮助,我们将不胜感激

我想出了这个解决方案。。。我相信有更好的办法

function returnFunc(value, index, array){
        if (value['formatter']){
            if (value['formatter'].indexOf("function")>-1){
                return value['formatter']=eval("(" + value['formatter'] + ")");
            }
        }
}
tdata[0].map(returnFunc);