jQuery-JTable: add on click event for row?
jquery, jquery-jtable, jquery-ui, spring-mvc
Solution
This should get you on your way:
$('#userTableContainer').jtable({
....
recordsLoaded: function(event, data) {
$('.jtable-data-row').click(function() {
var row_id = $(this).attr('data-record-key');
alert('clicked row with id '+row_id);
});
}
});
Problem
I have to following code to show my user table, this is achieved by JTable. ``` <script type="text/javascript"> $(document).ready(function() { $('#userTableContainer').jtable({ title: 'Users', selecting: false, paging: true, pageSize: 15, sorting: true, addRecordButton: false, saveUserPreferences: false, create: false, edit: false, actions: { listAction: 'user/getUsers.htm', }, fields: { username: { title: 'username' }, firstname: { title: 'firstname' }, lastname: { title: 'lastname' }, company: { title: 'company' } } }); $('#userTableContainer').jtable('load'); }); </script> <div id="content"> <h1>Users</h1> <br /> <div id="userTableContainer"> </div> </div> ``` Is it possible to add a custom action event for every row? So that i could submit a request like "user/showUser.htm" to my controller.