Filtering and export issues
Filtering and export issues

Hi,
so I'm new to the .net in general and to the datatable. I want to view data from multiple tables in one view, that's why I'm using ViewModel and two partial view _Department, _Permission and I render them from a third main view called myInfo.
I want to initialize each one of them as a datatable that has its own EXPOrt as an excel sheet and filtering.
the problem is only the department that the datatable applied in it . for simplicity I kept only one partial view to make as a data table. still the filtering not working and the export only gets the first column only in the excel sheet. I used developer tool to check if there is any error there wasn't I don't know where is my mistake. I appreciate any help .
myInfo view:
<div class="x_content">
<h3> Department</h3>
@{Html.RenderPartial("~/Views/UserPermission/PartialViews/_Department.cshtml", ViewData.Model.Departments);}
</div>
_Department view:
<table class="table " id="ViewData">
<thead>
<tr>
<th>
<b>
@Html.DisplayNameFor(model => model.Dep_Name)
</b>
</th>
<th>
<b>
@Html.DisplayNameFor(model => model.UserId)
</b>
</th>
</tr>
</thead>
@foreach (var item in Model)
{
<tbody>
<tr>
<td>
@Html.DisplayFor(modelItem => item.Dep_Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.UserId)
</td>
</tr>
</tbody>
}
</table>
<script>
$(document).ready(function () {
$('#ViewData').DataTable({
dom: 'Bfrtip',
"buttons": [
'copy', 'excel'
]
});
});
</script>********
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin