Thursday, 4 April 2019

JQuery Datatable add View Edit Delete Column in ASP.NET

"fnDrawCallback": function () {
    jQuery(element).find('thead tr th:last-child').replaceWith("<th>View / Edit</th>");
    jQuery(element).find('tbody tr').each(function () {
        var courseID = $(this).find('td:first-child').html();

        var links = "<a href='/view?id={{courseID}}'></a>";

$(this).find("td:last-child:not(:first-child)").replaceWith("<td>" + links.replace(/{{courseID}}/g, courseID) + "</td>");
    });
}



CSS to position search and page drop downlist:
.dataTables_filter {
    float: left !important;
    text-align: left !important;
}

.dataTables_length {
    float: right !important;
    text-align: right !important;

}


No comments:

SQL: Generate a range of numbers

SELECT ones.n + 10*tens.n + 100*hundreds.n + 1000*thousands.n FROM       (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) ones(n),      (VALU...