Add a class Before the datatable column in server side mvc and webapi
Add a class Before the datatable column in server side mvc and webapi
How do i add a AESCryptography descrypt method on datatable column.
Here is the table:
$(document).ready(function ()
{
debugger
$('#TableId').DataTable(
{
//"columnDefs": [
// { "width": "5%", "targets": [0] },
// {
// "className": "text-center custom-middle-align",
// "targets": [0, 1, 2, 3, 4, 5, 6]
// },
//],
'columnDefs': [{
'targets': 0,
'searchable': false,
'orderable': false,
"bLengthChange": false, "pageLength": 15, "stateSave": true,
'width': '1%',
'className': 'dt-body-center',
//'render': function (data, type, full, meta) {
// return '<input type="checkbox">';
//}
}
,
{
targets: 1,
render: function (data, type, row, meta) {
if (type === 'display') {
data = '<a href="/TicketTemplate/AppDetails/' + row.Id + ' " >' + data + '</a>';
}
return data;
}
},
{
targets: 0,
render: function (data, type, row, meta) {
return moment(data).format('DD/MM/YYYY HH:mm:ss');
}
},
{
//targets: 4,
//render: function (data, type, row, meta) {
// return AESCryptography.AES256_Decrypt(row.Email);
//}
//targets: 3,
//render: function (data, type, row, meta) {
// if (type === 'display') {
// data = '<a href="/TicketTemplate/AppDetails/' + row.Id + ' " >' + AESCryptography.AES256_Decrypt(row.data) + '</a>';
// }
// return data;
//}
}
],
"language":
{
"processing": "<div class='overlay custom-loader-background'><i class='fa fa-cog fa-spin custom-loader-color'></i></div>"
},
"processing": true,
"serverSide": true,
"order": [[0, "asc"]],
"ajax":
{
"url": "/TicketTemplate/GetData",
"type": "POST",
"dataType": "JSON"
},
"columns": [
//{ "data": '' },
{ "data": "CreatedDate" },
{ "data": "Title" },
//{
// //"data": "title",
// "render": function (data, type, row, meta) {
// //return '<a href=\"' + title + '\">' + title + '</a>';
// return '<a href="' + title + '">' + data + '</a>';
// }
//},
//{
//{
// //"data": "title",
// "render": function (data, type, row, meta) {
// //return '<a href=\"' + title + '\">' + title + '</a>';
// return "<a href=" + "/" + "/TicketTemplate/AppDetails/" + row.Id + " id=" + row.Id + ">" + row.Title + " </a>";
// }
//},
{ "data": "Name" },
{ "data": "Email" },
{ "data": "AssignTo" },
{ "data": "Status" }
]
});
});
In this table i am getting a Email Column with encrypted email(because email is encrypted in db).
I want to show the email with descrypted value. for decryption I am using a Method class name AESCryptography.AES256_Decrypt .
This is the path for the class EmailTemplate.UI\Utils/AESCryptography.cs.
So where should i write in datatable column.I am try to write in columnDefs column but not working???