Selecting specific rows while loading aaData via ajax
Selecting specific rows while loading aaData via ajax
edoarsla
Posts: 7Questions: 1Answers: 0
Using TableTools, "sRowSelect": "multi"
I am trying to select specific rows, for which aaData contains a field "checked" set to "true".
Here's the current code:
[code]
function updateApplications(prodIds)
{
$j.ajax({
type: "GET",
url: "/GetProductSpecificElementsServlet",
dataType: 'json',
data: { instance: 'false', products: prodIds, includeCluster: true }
}).done(function(data) {
var nodes = oAppTable.fnGetAllTrNodes();
// Clear all nodes from the table
for (var i=0; i
I am trying to select specific rows, for which aaData contains a field "checked" set to "true".
Here's the current code:
[code]
function updateApplications(prodIds)
{
$j.ajax({
type: "GET",
url: "/GetProductSpecificElementsServlet",
dataType: 'json',
data: { instance: 'false', products: prodIds, includeCluster: true }
}).done(function(data) {
var nodes = oAppTable.fnGetAllTrNodes();
// Clear all nodes from the table
for (var i=0; i
This discussion has been closed.
Replies
[code]
$( oAppTable.fnGetNodes( rowPosition[0] ) ).click();
[/code]
This works because TableTools adds a click event handler to the rows in the table and triggering it will cause the row to be selected.
The other option is to use the TableTools API to select the row - the fnSelect method in fact: http://datatables.net/extras/tabletools/api#fnSelect . You could do:
[code]
tableTools.fnSelect( oAppTable.fnGetNodes( rowPosition[0] ) );
[/code]
To get the TableTools instance you can use the fnGetInstance static method ( http://datatables.net/extras/tabletools/api#fnGetInstance ).
DataTables 1.10 and TableTools (next) will make this a bit easier. You'll be able to do something like: `table.row.add( ... ).select();` :-).
Regards,
Allan