Created
October 16, 2011 08:15
-
-
Save aaronksaunders/1290645 to your computer and use it in GitHub Desktop.
Function to scan through table rows to determine which ones are selected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* simple method to get the list of items selected | |
*/ | |
function checkedRowsAre() { | |
// get the rows; there is a default section in all tables so that | |
// is why we need to get the rows this way | |
var selected = []; | |
var rows = tableView.data[0].rows; | |
// iterate through the rows to find out which ones are selected, | |
// add the index to an array | |
for(var x in rows) { | |
if(rows[x].isGreen() === true) { | |
selected.push(x); | |
} | |
} | |
// flatten the array to a comma delimited string of row indexes | |
if(selected.length) { | |
return selected.join(","); | |
} else { | |
return ""; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment