【问题标题】:How to display HyperLink Data in JTable column?如何在 JTable 列中显示超链接数据?
【发布时间】:2015-01-19 11:53:57
【问题描述】:

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

下面是代码sn-p。

$('#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">'
        },

【问题讨论】:

    标签: jquery html ajax jquery-jtable


    【解决方案1】:

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

    我想这就是你想要的。

    添加字段display

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

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

    【讨论】:

    • 谢谢它帮了我很多:)
    • 您好,我已将上述显示:函数添加到日期代码中,日期显示格式:'dd-mm-y',选项未格式化日期:(
    • @ShoyebShaikh, blogs.lessthandot.com/index.php/WebDev/ServerProgramming/… 第二段讲述了如何解决这个问题。将`moment.js`文件添加到您的项目并添加此代码以进行格式化:display: function (data) { return moment(data.Date).format('DD/MM/YYYY HH:mm:ss'); }希望这会有所帮助,因为我从未使用过jTable :) 请设置您需要的日期格式
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-15
    • 2013-08-31
    • 2011-11-30
    • 2013-07-14
    • 2011-09-30
    相关资源
    最近更新 更多