Is there any way to programmatically select rows?
Is there any way to programmatically select rows?
I see an old post about this
http://www.datatables.net/forums/discussion/5074/programmatically-select-rows
but nothing in the current API. Is there a way to programmatically select rows?
Lets say I have 'Dept No' - when I click on that field I want to 'select' all persons (rows) that match that department number.
Seems like this should be easy... but.
Just changing class to 'DTTT_selected' highlights the row(s), but there must be something internal that needs to be done as well because I can see only the row I clicked on is returned by 'table.fnGetSelected()'
In my implementation, I want to select rows that match the 'Dept No' even if the row is not visible - like its on another page of the table (some of these tables are several hundred rows).
-AC
Replies
Ideally you need to do a few things:
I believe this should work even with the scroll plugin.
That doesn't seem to work... Yes, I can find all the rows that match my criteria,
then I call:
The rows are not highlighted, and fnGetSelected() returns 0;
The TableTools
fnSelect()
method will programmatically select rows (assuming you are using TableTools).Allan
Hmm... so this?
Should select row 1 .... but doesn't.
Ok... so what I am really not clear on, is how to tell fnSelect which row to select.
This example is close... it finds all matching dept numbers in the table, but the correct rows are not highlighted in the table. I think due to sorting, the table row index 'idx' is not correct.
Could use a clue on how to make it highlight the correct rows:
Example:
And... that led me to this WORKING example:
Woot!
Yup - that :-). The
fnSelect
function takes the rows to be selected.oTable[1]
doesn't work because it isn't a row node!Allan