【问题标题】:How to receive other datatables columns如何接收其他数据表列
【发布时间】:2019-03-12 22:11:41
【问题描述】:

关于 AJAX 和 Laravel 的问题。我正在使用 jquery datatables 插件。现在一切正常,请按预期返回我的数据。这是我的专栏部分

        columns: [
        {data: 'id', name: 'id'},
        {data: 'slug', name: 'slug'},
        {data: 'title',
            render: function (data, type, row, meta) {
                return '<a href="/super/artikels/">'+data+'</a>'
            }, name: 'title'  },
        { data: 'body' ,  name: 'body'  },
        { data: 'author' ,  name: 'author'},
        { data: 'created_at',  name: 'created_at' },
    ]

我的问题是如何将 slug 添加到标题的 url?

【问题讨论】:

    标签: ajax laravel datatables


    【解决方案1】:

    我假设您正在使用datatables jquery 插件,并且您可以使用 row 参数来访问其他列..

    render: function (data, type, row, meta) {
                    return '<a href="/super/artikels/'+row.slug+'">'+data+'</a>'
                }, name: 'title'  },
    

    【讨论】:

    • 感谢您的帮助。欣赏它
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-21
    • 2012-08-12
    • 1970-01-01
    • 2015-05-02
    • 2021-11-22
    • 1970-01-01
    • 2020-11-21
    相关资源
    最近更新 更多