I have two buttons inside a FOR, where I can remove or evaluate the registration of users who are still inactive, everything listed on page 1 works already on page 2 and doesn't even make the request, even filtering 2 or 10 per page. Only what is listed on the first page works.
I'm using jQuery and DataTable.
jq = $;
jq.noConflict();
// main
jq(function () {
jq('#capes').DataTable();
jq("div#example_length.dataTables_length").children('label').children('select').append(new Option("5", "5"));
jq(".remove_author_button").click(function (event) {
var r = confirm("Realmente deseja remover este registro?");
if (r === true) {
var buttonId = jq(this).attr('id').substring(7);
window.location = "<%= request.getContextPath() %>/register/manage-authors?operation=remove&id=" + buttonId;
}
});
jq(".check_author_button").click(function (event) {
console.log('your message');
var buttonId = jq(this).attr('id').substring(6);
window.location = "<%= request.getContextPath() %>/register/manage-authors?operation=check&id=" + buttonId;
});
});
<table id="capes" class="ui celled table" data-order='[[ 0, "asc" ]]' data-page-length='2'>
<thead>
<tr>
<th> </th>
<th> </th>
<th>Nome</th>
<th>E-mail</th>
<th>Intituição</th>
<th>Departamento</th>
<th>Situação</th>
</tr>
</thead>
<tbody>
<% if (authorList.size() > 0) { %>
<% for (Author author : authorList) {%>
<tr>
<td><input type="button" id="remove_<%= author.getID()%>" value="Remover" class="remove_author_button btn btn-danger"/></td>
<td><input type="button" id="check_<%= author.getID()%>" value="Avaliar" class="check_author_button btn btn-success"/></td>
<td><%= author.getEPerson().getFullName()%></td>
<td><%= author.getEPerson().getEmail()%></td>
<td><%= author.getInstitutionName()%></td>
<td><%= author.getDepartment()%></td>
<td><%= author.getActive() ? "Ativo" : "Inativo"%></td>
</tr>
<% } %>
<% }%>