Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/429.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/1/php/290.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 我有一个jqgrid表,我想在其中为文本中的某些关键字添加动态链接_Javascript_Php_Jquery_Jqgrid_Free Jqgrid - Fatal编程技术网

Javascript 我有一个jqgrid表,我想在其中为文本中的某些关键字添加动态链接

Javascript 我有一个jqgrid表,我想在其中为文本中的某些关键字添加动态链接,javascript,php,jquery,jqgrid,free-jqgrid,Javascript,Php,Jquery,Jqgrid,Free Jqgrid,我有一个jqgrid表,我想在其中为文本中的某些关键字添加动态链接。我有关键字作为键值对。我在中介绍了一个示例,它使用普通表数据,但不使用jqgrid表数据。谁能帮我解决这个问题 <script type="text/javascript"> var linksMap = { 'google': 'http://google.com', 'stackoverflow': 'http://stackoverflow.com', 'jquery': 'http://j

我有一个jqgrid表,我想在其中为文本中的某些关键字添加动态链接。我有关键字作为键值对。我在中介绍了一个示例,它使用普通表数据,但不使用jqgrid表数据。谁能帮我解决这个问题

  <script type="text/javascript">
  var linksMap = {
  'google': 'http://google.com',
  'stackoverflow': 'http://stackoverflow.com',
  'jquery': 'http://jquery.com'
  };

jQuery(document).ready(function () {    
$('#jqGrid>tbody td:nth-child(1)').each(function() {
var $td = $(this);
var name = $td.text();
var link = linksMap[name];
var $a = $('<a>').attr('href', link).text(name);
$td.html($a);
});
</script>

var linksMap={
“谷歌”:http://google.com',
“stackoverflow”:”http://stackoverflow.com',
“jquery”:”http://jquery.com'
};
jQuery(文档).ready(函数(){
$('#jqGrid>tbody td:n个子(1)')。每个(函数(){
var$td=$(本);
var name=$td.text();
var link=linksMap[name];
var$a=$('').attr('href',link).text(名称);
$td.html($a);
});

将此代码与jqgrid一起使用时,表会消失。是否有其他方法可以做到这一点。

您可以使用自定义格式设置程序。请查看文档以了解免费网格如何做到这一点。请您向我展示相关示例。