I am using JQuery DataTables on my DataList page in ASP.NET MVC 5. I add
print buttons to it. I couldn't figure out, how to move the "print buttons" above the search box?
Screen shot and code is below. Can somebody help me how to fix this problems.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
576 Points
361 Posts
How to move Print Buttons above Search bar of JQuery DataTables
Apr 17, 2019 08:37 PM|eaak79|LINK
Hi there,
I am using JQuery DataTables on my DataList page in ASP.NET MVC 5. I add print buttons to it. I couldn't figure out, how to move the "print buttons" above the search box?
Screen shot and code is below. Can somebody help me how to fix this problems.
Javascript/Jquery:
Thanks in advance.
Contributor
2100 Points
705 Posts
Re: How to move Print Buttons above Search bar of JQuery DataTables
Apr 18, 2019 03:12 AM|Jenifer Jiang|LINK
Hi eaak79,
According to your description, I suggest that you could create a div and append the buttons to it.
About customizing position of the buttons, you could refer to: https://datatables.net/extensions/buttons/
Here is my sample.
result:
Best Regards,
Jenifer
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
576 Points
361 Posts
Re: How to move Print Buttons above Search bar of JQuery DataTables
Apr 18, 2019 10:56 AM|eaak79|LINK
Thanks alot Jenifer, I have solved the problem using your suggestion. The modified code is below for future reference.
Note: Yellow highlighted text is the modified code.
Screen shot:
View:
@model List<StudentLMS.Models.Employee.EmployeeModel> @{ ViewBag.Title = "Employees List Screen"; } <br/> <div class="panel panel-info"> <div class="panel-heading"> <h2 class="panel-title">Employees List</h2> </div> <div class="panel-body"> <a href='@Url.Action("EmployeeInfo", "Employee")' class = "btn btn-success">Add New <i class="fas fa-plus"></i></a> <div id="printbar" style="float:right"></div> <br /> <br/> <table id="jdTable" class="table table-condensed table-striped table-hover"> <thead> <tr> <th>Employee ID</th> <th>Employee Name</th> <th>Gender</th> <th>CNIC</th> <th>Mobile</th> <th>Email </th> <th></th> </tr> </thead> <tbody> @foreach (var s in Model) { <tr> <td>@s.EmployeeID</td> <td>@s.EmployeeName</td> <td>@s.Gender</td> <td>@s.CNIC</td> <td>@s.Mobile</td> <td>@s.Email</td> <td> <a href='@Url.Action("Edit","Employee",new { id = @s.EmployeeID })'><i class="fas fa-pen-square fa-2x"></i></a> </td> </tr> } </tbody> </table> </div> </div>
JavaScript/Jquery:
thanks again.