Skip to content

Instantly share code, notes, and snippets.

@aaronksaunders
Created October 16, 2011 08:15
Show Gist options
  • Save aaronksaunders/1290645 to your computer and use it in GitHub Desktop.
Save aaronksaunders/1290645 to your computer and use it in GitHub Desktop.
Function to scan through table rows to determine which ones are selected
/**
* 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