I have a function which popup a modal window:
function showTable(employees) {
var result = $('#empl');
result.empty();
$.each(employees, function (index, employee) {
var tr = $('<tr/>');
tr.append($('<td/>').html(employee.id));
tr.append($('<td/>').html(employee.name));
result.append(tr);
});
$('#myModal').modal('show');
}
And code which invoke this function:
<button type="button" class="btn" onclick="showTable(${company.employees})">View</button>
My Company class
public class Company implements Serializable {
private Integer id;
private String name;
private List<Employee> employees;
But function doesn't work. How to make it work?
employeewhile your code statesemployees.onclick="showTable(${company.employees})"is NOT doing what you hope it does.