I found this answer in this question.
In the answer, it says:
"mData": "Name",
"mRender": function (data, type, row) {
return "<a href='Admin/Categories/Edit/" + data + "'>EDIT</a>";
I'm look for a way to include two variables, for instance:
"mData": ["Name", "User"],
"mRender": function (data, type, row) {
return "<a href='Admin/Categories/Edit/" + data[0] + data[1] + "'>EDIT</a>";
Is there any way I can do that?
The row
argument contains all the data for that row. The data
argument contains the data specified in the column options. So you would do something like
data: 'Name',
render: (data, type, row) => `<a href="Admin/Categories/Edit/${data}/${row.User}">EDIT</a>`
or you could set the data
property as null
and just use the row
argument
data: null,
render: (data, type, row) => `<a href="Admin/Categories/Edit/${row.Name}/${row.User}">EDIT</a>`