如何在JTable列中显示HyperLink数据?

时间:2015-01-19 11:53:58

标签: jquery html ajax jquery-jtable

我想显示从jtable收到的数据的href。

以下是代码段。

$('#JarDistHist').jtable({
    title: 'Jar Distribution History',
    paging: true,
    //pageSize: 10,
    sorting: true,
    defaultSorting: 'Date ASC',
    actions: {
        listAction: 'StudentActions.php?action=list&DistId=' + cname + '&fitem=' + fitem + '',


        deleteAction: 'StudentActions.php?action=delete'
    },
    fields: {
        id: {

            key: true,
            create: false,
            edit: false,
            list: false,

        },
        Date: {
            title: ' Date',
            type: 'date',
            displayFormat: 'dd-mm-y',
            width: '40%',
            options: '<a href="JarFillingDetail.php?id">'
        },

1 个答案:

答案 0 :(得分:2)

请看这个链接:http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/nancy-and-jtable-formatting-your/

我认为这就是你想要的。

添加字段display

  

当我们为jtable配置字段时,我们有一个display属性   这需要一个函数,在该函数中我们可以进行格式化。

display: function (data) {
                            return $('<a href="JarFillingDetail.php?id="' + data.Id + '"></a>');
                         }