how can i get id of the highlighted row and send it to controller to update status of the that record in database without using json object means as a simple java object.
Typically you would use TableTools to add a button to start. Then you use the click event on the button to capture the id of a selected row, like this:
[code]
{
"sExtends": "text",
"sButtonText": "View Ads",
"fnClick": function()
{
var ID = "";
var selectedRows = this.fnGetSelected();
if(selectedRows == "")
{
alert("No record has been selected");
return;
}
var firstId = selectedRows[0].id;
//remove the "row_" prefix
ID = firstId.substring(4,firstId.length);
window.location.href = "Ads.jsp?id=" + ID;
}
}
[/code]
In this case, every record has an ID column where each ID is prefixed with "row_" string. In this code I'm stripping away the prefix just to get the numeric value and passing that onto a JSP page which performs a lookup on the database and displays more info.
Since you're on the Java platform, I suggest you visit the JED website. JED was designed to demonstrate how DataTables is used on the Java platform.
Check it out: http://jed-datatables.ca/jed/
Replies
Allan
[code]
{
"sExtends": "text",
"sButtonText": "View Ads",
"fnClick": function()
{
var ID = "";
var selectedRows = this.fnGetSelected();
if(selectedRows == "")
{
alert("No record has been selected");
return;
}
var firstId = selectedRows[0].id;
//remove the "row_" prefix
ID = firstId.substring(4,firstId.length);
window.location.href = "Ads.jsp?id=" + ID;
}
}
[/code]
In this case, every record has an ID column where each ID is prefixed with "row_" string. In this code I'm stripping away the prefix just to get the numeric value and passing that onto a JSP page which performs a lookup on the database and displays more info.
Since you're on the Java platform, I suggest you visit the JED website. JED was designed to demonstrate how DataTables is used on the Java platform.
Check it out: http://jed-datatables.ca/jed/