danielolorenz
asked on
My JQuery Data Tables Did Not Load After Page Load?
On MVC when I try to table load JQuery DataTable on the page load it does not attach to my HTML table.
When I use the AJAX onComplete to trigger the JQuery table load it works fine.
My JQuery table load routine:
function onEMailNotificationsComple te() {
alert("onEMailNotification sComplete" );
$('#email-notifications-re sults table').dataTable({
"bFilter": true,
"bSort": true,
"bLengthChange": false,
"bPaginate": true,
"sPaginationType": "full_numbers",
"sDom": "<'row'<'col-md-6'i><'col- md-6'f>r>t <'row'<'co l-md-6'i>< 'col-md-6' p>>",
"bInfo": true
});
}
HTML Table:
Thanks,
Dan
When I use the AJAX onComplete to trigger the JQuery table load it works fine.
My JQuery table load routine:
function onEMailNotificationsComple
alert("onEMailNotification
$('#email-notifications-re
"bFilter": true,
"bSort": true,
"bLengthChange": false,
"bPaginate": true,
"sPaginationType": "full_numbers",
"sDom": "<'row'<'col-md-6'i><'col-
"bInfo": true
});
}
HTML Table:
<table id="email-notifications-results" class="table table-bordered table-striped table-hover">
<thead>
<tr>
<td>
<strong>Date E-Mail Sent</strong>
</td>
<td>
<strong>Applicant Id</strong>
</td>
<td>
<strong>Person Name</strong>
</td>
<td>
<strong>Background Check Results</strong>
</td>
</tr>
</thead>
<tbody>
@foreach (var emailNotification in Model)
{
var dateEMailSent = emailNotification == null ? "" : emailNotification.DateEMailSent.ToShortDateString();
<tr>
<td>
@Html.DisplayFor(model => dateEMailSent)
</td>
<td>
@Html.DisplayFor(model => emailNotification.ApplicantId)
</td>
<td>
@Html.DisplayFor(mode => emailNotification.PersonName)
</td>
<td>
@Html.DisplayFor(mode => emailNotification.BackgroundCheckResults)
</td>
</tr>
}
</tbody>
</table>
Thanks,
Dan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks,
Dan