I'm loading data into a table using ajax that calls my controller function. When a new page is selected or a column is sorted, I reload the data by using ajax to that same original controller function. This is so that I don't load all of the items right away, only when needed. I want to make each row have an onclick javascript function where I can get the column information from that row that was clicked. Any ideas? The controller function just gets my data based on what result range the user wants to see and what sorted order.
My only javascript code is the following:
<script>
$(function() {
var oTable;
oTable = $('#tblItemModel').DataTable({
"serverSide": true,
"paginate": true,
"ajaxSource": "/Finance/ItemListAjax",
"processing": true,
"serverMethod": "GET",
"displayLength": 50
});
})
</script>
My html is the following:
<table class="table table-striped at-table" id="tblItemModel">
<thead>
<tr>
<th>
Id
</th>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.ListPrice)
</th>
<th>
@Html.DisplayNameFor(model => model.DiscountPrice)
</th>
</tr>
</thead>
<tbody class="mousechange"></tbody>
</table>