Hello ,I want to check the Article's Status, if true the Edit button will be disabled else the user can click and switch to the Edit page. How to use it?
$(document).ready(function () {
var table = $('#studentArticleTable').DataTable();
var button = table.button
({
info: false,
ajax: {
url: '/Student/GetPersonalArticles',
dataSrc: ''
},
rowId: "id",
columns: [
{ data: 'title', title: 'Title' },
{ data: 'faculty.facultyName' , title: 'Faculty' },
{ data: 'status', title: 'Status', render: function (data)
{
if (data == false) {
return 'Waiting for Approve';
} else {
return 'Approved';
}
}
},
{ data: 'createAt', title: 'Create At', render: function (data){
return moment(data).format("HH:mm - DD/MM/YYYY");
}},
{ data: 'updateAt', title: 'Update At', render: function (data) {
return moment(data).format("HH:mm - DD/MM/YYYY");
}},
{
data: 'id',
className: "center",
title: 'Actions',
render: function (data) {
@if (Model.Status == true)
{
}
else
{
}
return '<a href="Student/EditArticle/' + data + '" class="btn btn-success mr-1"> Edit </a>';
}}
],
order: [1, 'asc']
});
What I have tried:
I tried creating the button from the Datatables example but it didn't help me get to the hrel I wanted