Javascript Json Datatable - B M SOLUTION
  • Javascript Json Datatable

     <table class="table table-striped- table-bordered table-hover table-checkable table-sm" id="table_pend10">

        <thead>

            <tr>

                @*




                *@


                @*

            <th style="width:2%;"> Sec </th>


            <th style="width:6%;"> Status</th>*@

                <th style="width:2%;"> # </th>

                <th style="width: 5%;"> SR.No </th>

                <th style="width:8%;"> Admission Date </th>

                <th style="width:5%;"> Type </th>

                <th style="width:16%;"> Student Name </th>

                <th style="width:16%;"> Father Name</th>

                <th style="width:8%;"> DOB </th>

                <th style="width:8%;"> Class </th>

                <th style="width:6%;"> Mobile No</th>

                <th> Actions </th>

                <th>AC2</th>

                <th>AC3</th>

            </tr>

        </thead>


    </table>


    <script>

        $(document).ready(function () {

            var i = 1;

            $("#table_pend10").DataTable({

                "processing": true,

                "serverSide": true,

                "filter": true,

                "ajax": {

                    "url": "/Admin/GetEmployeedata",

                    "type": "POST",

                    "datatype": "json"

                },

                "columnDefs": [{

                    // "targets": [0],

                    "visible": false,

                    "searchable": false

                }],

                "columns": [


                    {

                        "render": function (data, type, full, meta) {

                            return i++;

                        }

                    },

                    {

                        data: null, render: function (data, type, full, meta) {

                            return "<a href='javascript:void(0)" + full.Id + "' title='View Fee Detail' data-toggle='modal' data-target='modal'  onclick=PopulateAppDetail('" + full.Id + "','" + full.Class + "','" + full.StudentType + "'); >" + full.SRNo + "</a>";

                        }

                    },  

                    { "data": "AdmissionDates", "name": "AdmissionDates", "autoWidth": true },

                    {

                        "render": function (data, type, full, meta) {

                            return '<a  href="/Admin/ChangeStuType?Id=' + full.Id + '" Style="color:red;"> ' + full.StudentType + ' </a>';

                        }

                    },

                    { "data": "StudentName", "name": "StudentName", "autoWidth": true },

                    { "data": "FatherName", "name": "FatherName", "autoWidth": true },

                    { "data": "DOB", "name": "name", "DOB": true },

                    { "data": "Class1", "name": "Class1", "autoWidth": true },


                    { "data": "MobileNo", "name": "MobileNo", "autoWidth": true },

                    {

                        "render": function (data, type, full, meta) { return '<a class="btn btn-info" href="/Admin/DeleteStudentRegistration?Id=' + full.Id + '">Delete</a>'; }

                    }, 

                    {

                        "render": function (data, type, full, meta) {

                            return '<div class="dropdown dropdown-inline"><a href="javascript:;" class="btn btn-sm btn-clean btn-icon" data-toggle="dropdown" aria-expanded="false"> <i class="la la-cog"></i></a><div class="dropdown-menu dropdown-menu-sm dropdown-menu-right" style="display: none;"><ul class="nav nav-hoverable flex-column"><li class="nav-item"><a class="nav-link" href="/Admin/DeleteStudentRegistration?Id=' + full.Id + '"><i class="nav-icon la la-trash text-danger"></i><span class="nav-text">Delete</span></a></li><li class="nav-item"><a class="nav-link" href="/Admin/AddStudentRegistration?Id=' + full.Id + '"><i class="nav-icon la la-edit text-warning"></i><span class="nav-text">Edit Details</span></a></li><li class="nav-item"><a class="nav-link" href="/Report/Registration.aspx?Id=' + full.Id + '"><i class="nav-icon la la-user text-primary"></i><span class="nav-text">Profile Details</span></a></li><li class="nav-item"><a class="nav-link" title="Apply Transport Yes/No" onclick=" return confirm("Are you sure, Do You Want to Apply Transport ?");" href="/Admin/ApplyTransport?Id=' + full.Id + '"><i class="nav-icon-xl la la-bus text-success"></i><span class="nav-text">Transport Status</span></a></li><li class="nav-item"><a class="nav-link" title="Apply Hostel Day/Night" onclick=" return confirm("Are you sure, Do You Want to Apply Hostel ?"); " href="/Admin/ApplyHostel?Id=' + full.Id + '"><i class="nav-icon la la-building text-dark"></i><span class="nav-text">Apply Hostal</span></a></li></ul></div></div>';

                        }


                    },

                    {

                        "render": function (data, type, full, meta) {

                            return '<div class="dropdown dropdown-inline">'

                            +'<a href="javascript:;" class="btn btn-sm btn-clean btn-icon" data-toggle="dropdown" aria-expanded="false"> <i class="la la-cog"></i></a>'

                            +'<div class="dropdown-menu dropdown-menu-sm dropdown-menu-right" style="display: none;">'

                            +'<ul class="nav nav-hoverable flex-column">'

                            +'<li class="nav-item"><a class="nav-link" href="/Admin/DeleteStudentRegistration?Id=' + full.Id + '"><i class="nav-icon la la-trash text-danger"></i><span class="nav-text">Delete</span></a></li>'

                            +'<li class="nav-item"><a class="nav-link" href="/Admin/AddStudentRegistration?Id=' + full.Id + '"><i class="nav-icon la la-edit text-warning"></i><span class="nav-text">Edit Details</span></a></li>'

                            +'<li class="nav-item"><a class="nav-link" href="/Report/Registration.aspx?Id=' + full.Id + '"><i class="nav-icon la la-user text-primary"></i><span class="nav-text">Profile Details</span></a></li>'

                            +'<li class="nav-item"><a class="nav-link" title="Apply Transport Yes/No" onclick=" return confirm("Are you sure, Do You Want to Apply Transport ?");" href="/Admin/ApplyTransport?Id=' + full.Id + '"><i class="nav-icon-xl la la-bus text-success"></i><span class="nav-text">Transport Status</span></a></li>'

                            +'<li class="nav-item"><a class="nav-link" title="Apply Hostel Day/Night" onclick=" return confirm("Are you sure, Do You Want to Apply Hostel ?"); " href="/Admin/ApplyHostel?Id=' + full.Id + '"><i class="nav-icon la la-building text-dark"></i><span class="nav-text">Apply Hostal</span></a></li>'

                           + '</ul></div></div>';

                        }


                    }

                ],

                //dom: 'Bfrtip',

                //buttons: [

                //    'copy', 'csv', 'excel', 'pdf', 'print'

                //]

            });

        });

    </script>

  • You might also like

    No comments :

    Post a Comment