Hi,
Can anyone try to add custom button to a data table or change its column type to hyperlink to redirect or get data of specific row?
Thanks for helping and giving opinion.
DataTable Custom Button per Rows
Moderator: jeanmichel
-
dylan.ramirez
- Posts: 7
- Joined: 15 Nov 2022, 16:03
DataTable Custom Button per Rows
- Attachments
-
- dt_screenshot.png (7.52 KiB) Viewed 6028 times
Re: DataTable Custom Button per Rows
Hi,
While the use of datatables in aXes is mostly to just display data not really to interact with it,
according to this example:
https://datatables.net/examples/ajax/nu ... ource.html
you basically have to use this for columnDefs to get a button there:
which translates to aXes to go to columnDefs, edit it and put this code there:
to get this result:
now what to do with the onclick action and where to put that no idea but is supposed to be a code like this:.
While the use of datatables in aXes is mostly to just display data not really to interact with it,
according to this example:
https://datatables.net/examples/ajax/nu ... ource.html
you basically have to use this for columnDefs to get a button there:
Code: Select all
columnDefs: [
{
targets: -1,
data: null,
defaultContent: '<button>Click!</button>',
},Code: Select all
ENV.returnValue = [
{
targets: -1,
data: null,
defaultContent: '<button>Click!</button>',
},
];now what to do with the onclick action and where to put that no idea but is supposed to be a code like this:
Code: Select all
$('#example tbody').on('click', 'button', function () {
var data = table.row($(this).parents('tr')).data();
alert(data[0] + "'s salary is: " + data[5]);
});-
dylan.ramirez
- Posts: 7
- Joined: 15 Nov 2022, 16:03
Re: DataTable Custom Button per Rows
thanks for the help! I appreciate.