【问题标题】:Adding Link to Cell in Jquery Easy UI在 Jquery Easy UI 中添加到单元格的链接
【发布时间】:2014-10-14 07:39:38
【问题描述】:

我想使用格式化程序在以下数据网格表中添加打印按钮。

数据网格:

 <thead>
    <tr>
    <th field="id" align="center" sortable="true" >ID</th>
    <th field="name"  sortable="true">Name</th>
    <th field="department" align="center" sortable="true">Department</th>
    <th field="phone" align="center" sortable="true">Phone No</th>
    <th data-options="field:'id', formatter:quickPrint">Print</th>
 </thead>

格式化函数:

  function quickPrint(val,row){
      var url = "print.php?id=";
      return '<a href="'+url + row.id+'">Print</a>';
  }

打印.php

 <?php
   $id=htmlspecialchars($_GET['id']);
   //my other codes go here
  ?>

我想在print.php 文件中发送 id 值并使用$_GET 获取 id 值。问题是只显示id 值并且它们没有可点击的链接。非常欢迎任何帮助和建议。提前致谢。

【问题讨论】:

    标签: jquery hyperlink jquery-easyui


    【解决方案1】:

    首先删除数据网格中的第一个 id 行,如下所示:

    <thead>
    <tr>    
    <th field="name"  align="left">Name</th>
    <th field="department" align="left" sortable="true">Department</th>
    <th field="phone" align="right" sortable="true">Phone No</th>
    <th field="id" align="center" formatter="quickPrint">Print</th>
    </thead>
    

    你的函数应该是这样的:

    <script>
    function quickPrint(value,row){
        var url = 'print.php?id='+row.id;
        return '<a target="_blank" href="' + url + '"><button>Print</button></a>';
        }
    </script>
    

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-28
      • 2018-07-22
      相关资源
      最近更新 更多