Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.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/jquery/81.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
Php jquery组合了两个mysql值_Php_Jquery_Mysql - Fatal编程技术网

Php jquery组合了两个mysql值

Php jquery组合了两个mysql值,php,jquery,mysql,Php,Jquery,Mysql,我使用jquery(JQwidgets)在网格中显示值。我有一个包含多个列的数据库,假设我在a列中有值“”,在B列中有值“Google” 我想要的是在网格中显示“Google”,当人们点击它时,它会打开url 现在我有一个从数据库中获取变量的代码 var source = { datatype: "json", datafields: [ { name: 'sitename', type: '

我使用jquery(JQwidgets)在网格中显示值。我有一个包含多个列的数据库,假设我在a列中有值“”,在B列中有值“Google”

我想要的是在网格中显示“Google”,当人们点击它时,它会打开url

现在我有一个从数据库中获取变量的代码

        var source =
        {
            datatype: "json",
            datafields: [
            { name: 'sitename', type: 'string'},
    { name: 'url', type: 'string'},
            ],
            url: 'http://www.site.com/data.php',  
            cache: false
        };
之后,将使用此

  $("#jqxgrid").jqxGrid(
        {
            pagesize : 25,
            pagesizeoptions: ['25', '50', '100'],
            width : 1170,
            theme:"black",
            source: dataAdapter,
            pageable: true, 
            autoheight: true,
            selectionmode: 'multiplecellsextended',
            columns: [
            { text: 'Website', datafield: 'website' , width: 700, cellsrenderer: linkrenderer},
            ]
        });
因此,我无法将这两种价值观结合起来。我试过的是这个

        var website = function (row, datafield, value) {
            return 'sitename' + 'url';
        }

您尚未设置linkrenderer函数

在其上方,添加

var linkrenderer = function(row, column, value, defaultHtml, columnSettings, rowData) {
   return '<a href="' + rowData.url + '">' + value + '</div>';
}
隐藏URL列

$("#jqxgrid").jqxGrid('hidecolumn', 'url');

谢谢你的回复。但是,这是我的链接渲染器…-var linkrenderer=function(row,column,value){if(value.indexOf('#')!=-1){value=value.substring(0,value.indexOf('#');}var format={target:'''u blank“data rokbox=”“');var html=$.jqx.dataFormat.formatlink(value,format);return html;}看起来您没有使用“网站”列,因为它不在数据源中的数据字段中。但是如果您是,那么只需创建单独的列(url和sitename)并使用我提供的CellsRender函数。
$("#jqxgrid").jqxGrid('hidecolumn', 'url');