Skip to content

How to add custom column defination jquery-datatables tag binding? #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
abhishekbhalani opened this issue Nov 19, 2019 · 3 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@abhishekbhalani
Copy link

How to add custom column like edit, delete while binding jquery-datatables tag datatable?

@DavidSuescunPelegay
Copy link
Owner

Hi, I'll check it out and in the next days I'll push a new version with this new feature.

Stay tuned.

@DavidSuescunPelegay DavidSuescunPelegay added the enhancement New feature or request label Apr 22, 2020
@stzoran1
Copy link

stzoran1 commented May 28, 2020

You can do something like this:


// Column Definitions
        columnDefs: [
            { targets: "no-sort", orderable: false },
            { targets: "no-search", searchable: false },
            {
                targets: "trim",
                render: function (data, type, full, meta) {
                    if (type === "display") {
                        data = strtrunc(data, 10);
                    }

                    return data;
                }
            },
            { targets: "date-type", type: "date-eu" },
            {
                "targets": 6,
                "data": null,
                "defaultContent": "<a class='btn btn-link btn-link-MY' role='button' href='#' onclick='edit(this)'><i class='fa fa-pencil'></i></a>",
                "orderable": false
            },
        ]


function edit(elem) {

    var data = table.row($(elem).parents('tr')).data();
    window.location = '../../../../Customers/Edit/' + data['customerID'];

}

@DavidSuescunPelegay
Copy link
Owner

Hi @abhishekbhalani and @stzoran1, I've just pushed a new release with custom column tag binding support.

You can download the latest release here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants