Hi
I am getting this error when i wrote render lines
Uncaught TypeError: Cannot read property 'style' of undefined
at Fa (jquery.dataTables.min.js:62)
at ha (jquery.dataTables.min.js:48)
at e (jquery.dataTables.min.js:93)
at HTMLTableElement. (jquery.dataTables.min.js:93)
{
"render": function (data, type, full, meta)
{ return "Update"; }
},
{
data: null, render: function (data, type, row) {
return "Delete";
}
},
- $(document).ready(function () {
- $("#tblLocation").dataTable({
- ajax: {
- type: "get",
- url: "/Location/List",
- dataType: "json",
- dataSrc: ""
- },
- paging: true,
- sort: true,
- pageLength: 10,
- searching: true,
- columns: [
- { 'data': 'Id', "autoWidth": true },
- { 'data': 'Description', "autoWidth": true },
- { 'data': 'IsActive', "autoWidth": true },
- $(document).ready(function () {
-
- $("#tblLocation").dataTable({
- ajax: {
- type: "get",
- url: "/Location/List",
- dataType: "json",
- dataSrc: ""
- },
- paging: true,
- sort: true,
- pageLength: 10,
- searching: true,
- columns: [
- { 'data': 'Id', "autoWidth": true },
- { 'data': 'Description', "autoWidth": true },
- { 'data': 'IsActive', "autoWidth": true },
- {
- "render": function (data, type, full, meta)
- { return "Update"; }
- },
- {
- data: null, render: function (data, type, row) {
- return "Delete";
- }
- },
- ]
- });
- });
- },
- ]
- });
- $('body').on('click', '[id*=btnEdit]', function () {
- var data = $(this).parents('tr').find('td');
- var id = data.eq(0).html();
- var description = data.eq(1).html();
- $('[id*=txtId]').val(id);
- $('[id*=txtDescription]').val(description);
- $("#btnAdd").hide();
- $(".modal-title").html("Update");
- $("#btnUpdate").show();
- $('#myModal').modal("show");
- });
- });
below is the sequence of Js file in Layout
- <script src="~/components/jquery/dist/jquery.min.js"></script>
- <script src="~/components/bootstrap/dist/js/bootstrap.min.js"></script>
- <!-- DataTables -->
- <script src="~/components/datatables.net/js/jquery.dataTables.min.js"></script>
- <script src="~/components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
Thanks