Add searching aspect in my code

Add searching aspect in my code

Ant6729Ant6729 Posts: 3Questions: 2Answers: 0

Hello!!
I try to use this one https://datatables.net/examples/api/form.html in my code

@model IEnumerable<ExportExcelDemo.Models.EmployeeViewModel>

<a class="btn btn-success" style="margin-bottom:10px" onclick="PopupForm('@Url.Action("AddOrEdit","Employee")')"><i class="fa fa-plus"></i> Add New</a>

@if (Model != null) { foreach (var item in Model) { if (item.Experience < 5) { } else { } } }
EmployeeId EmployeeName Email Phone Experience
@item.EmployeeId @item.EmployeeName @item.Email @item.Phone @item.Experience
@item.EmployeeId @item.EmployeeName @item.Email @item.Phone @item.Experience

<link href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" rel="stylesheet" />

<a href="@Url.Action("ExportToExcel","Home")" class="btn btn-success"><i class="fa fa-file-excel-o"></i>Export Excel</a>

@section scripts{

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

<script>

    $(document).ready(function () {
        var table = $('#employeeTable').DataTable({
            columnDefs: [{
                orderable: false,
                targets: [2, 3]
            }]
        });

        $('button').click(function () {
            var data = table.$('input, select').serialize();
            alert(
                "The following data would have been submitted to the server: \n\n" +
                data.substr(0, 120) + '...'
            );
            return false;
        });
    });


</script>

}

But nothing is going on)

Could you help me?

Answers

This discussion has been closed.