1

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?

AGamePlayer
  • 7,404
  • 19
  • 62
  • 119

1 Answers1

1

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>`
mark_b
  • 1,393
  • 10
  • 18