Hi
I have below DataTable . I want to use Sorting,Pagelength like settings Centralised thru Class so that it can be used on all DataTables, With the below code i have to write it on every Index.
- $(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' },
- { 'data': 'Description' },
- { 'data': 'IsActive' },
- {
- "defaultContent": ''
- }
- //
- //
- ]
- });
- $('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");
- });
- });
Thanks
Sachin SinghPosted May 30, 2021, 7:42 AM
Yogeshkumar HadiyaPosted May 30, 2021, 6:57 AM
Ramco RamcoPosted May 30, 2021, 5:24 AM
Sachin SinghPosted May 29, 2021, 4:40 PM