Datatable paganation do not Referesh after data submit - B M SOLUTION
  • Datatable paganation do not Referesh after data submit



    <script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>

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


        <thead>

            <tr>

                <th>#</th>

                <th>Pic</th>


                <th>User Name</th>

                <th>EmailId</th>

                <th>Mobile</th>

                <th>Role</th>

                <th>Status</th>

                <th>Action</th>

            </tr>

        </thead>

        <tbody>

            @{

                int SNo = 0;

            }

            @foreach (var item in Model.LoginList)

            {

                SNo++;

                <tr>

                    <td> @SNo. </td>

                    <td>


                        <div class="gal">

                            <a class="fancybox" rel="group" href="@item.UserPic" title="">

                                <div class="mt-action-img zoom">

                                    @if (item.UserPic != "")

                                    {

                                        <img src="@item.UserPic" alt="" style="width: 28px; height: 26px; margin-top: -21px; margin-left: -14px; align-items: center;" />

                                    }

                                    else

                                    {

                                        <img src="~/assets/media/users/student.png" alt="" style="width: 28px; height: 26px; margin-top: -21px; margin-left: -14px; align-items: center;" />

                                    }


                                </div>

                            </a>

                        </div>


                    </td>


                        <td>

                            @item.UserName.Replace('-',' ')

                        </td>

                        <td>

                            @item.Email

                        </td>

                  


                    <td> @item.MobileNo </td>

                    <td> @item.Role </td>


                    <td>

                        <a href="/Admin/ApproveUser?Id=@item.Id" style="color: red;" onclick=" return confirm('Are you sure, you want to change status?'); ">


                            @if (item.Extra1 == "Approve")

                            {

                                <span class="badge badge-success"> Approved </span>

                            }

                            else

                            {

                                <span class="badge badge-danger"> Blocked </span>

                            }

                        </a>

                    </td>


                    <td>

                        @if (Model.PermissionList.Where(s => s.MenuName == "User" && s.UpdateRecord == "on").ToList().Count > 0 || ViewBag.Role == "Admin")

                        {

                            <a href="/Admin/AddUser?Id=@item.Id" class="btn btn-icon btn-warning btn-xs mr-1"><i class="fa fa-edit" data-container="body" data-toggle="tooltip" data-placement="top" title=""></i></a>


                        }

                        @if (Model.PermissionList.Where(s => s.MenuName == "User" && s.DeleteRecord == "on").ToList().Count > 0 || ViewBag.Role == "Admin")

                        {

                            <a href="/Admin/DeleteUser?Id=@item.Id" class="btn btn-icon btn-youtube btn-xs mr-1"><i class="flaticon-delete" data-container="body" data-toggle="tooltip" data-placement="top" title=""></i></a>



                        }

                        @if (Model.PermissionList.Where(s => s.MenuName == "Add User" && s.AddRecord == "on").ToList().Count > 0 || ViewBag.Role == "Admin")

                        {

                            <a href="/Admin/AddPermission?Id=@item.Id" class="btn btn-icon btn-success btn-xs mr-1"><i class="flaticon-user" data-container="body" data-toggle="tooltip" data-placement="top" title=""></i></a>



                        }

                        @if (Model.PermissionList.Where(s => s.MenuName == "Add User" && s.AddRecord == "on").ToList().Count > 0 || ViewBag.Role == "Admin")

                        {

                            if (item.Role == "CLERK")

                            {

                            <a href="/Admin/Addwork_Area_Distribution?Id=@item.Id" class="btn btn-icon btn-info btn-xs mr-1"><i class="fab fa-wordpress" data-container="body" data-toggle="tooltip" data-placement="top" title=""></i></a>

                            }

                        }

                    </td>

                </tr>

            }

        </tbody>

    </table>



    <br />

    <script>

        $(document).ready(function () {

            $('#example').DataTable({

                stateSave: true,

            });

        });

    </script>

  • You might also like

    No comments :

    Post a Comment