How to get the id of the first row of the datatable on every instance
How to get the id of the first row of the datatable on every instance
aditya369
Posts: 1Questions: 0Answers: 0
I would like to get the id of the first row in the table on every instance like when we go to next page or when sort the data. Currently the below code is working properly to fetch the data dynamically from the database and sorting data. So, I would like to get the id of the first TR from the table. Can someone suggest me how to get this? Thanks for your help in advance..
Here is my code...
[code]
$(document).ready(function(){
var oTable = $('#allrows').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "id_server_processing.php",
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 3 ] },
{ "bSortable": false, "aTargets": [ 4 ] }
]
});
$('#allrows').on('click', 'tbody tr',function () {
var id = this.id;
id = id.split('_');
$('#allrows tr.row_selected').removeClass('row_selected');
$(this).addClass('row_selected');
});
});
Rendering engine
Browser
Platform
Engine version
CSS grade
Loading data from server
[/code]
Here is my code...
[code]
$(document).ready(function(){
var oTable = $('#allrows').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "id_server_processing.php",
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 3 ] },
{ "bSortable": false, "aTargets": [ 4 ] }
]
});
$('#allrows').on('click', 'tbody tr',function () {
var id = this.id;
id = id.split('_');
$('#allrows tr.row_selected').removeClass('row_selected');
$(this).addClass('row_selected');
});
});
Rendering engine
Browser
Platform
Engine version
CSS grade
Loading data from server
[/code]
This discussion has been closed.