Skip to content

Instantly share code, notes, and snippets.

@topherfangio
Created July 16, 2011 15:12
Show Gist options
  • Save topherfangio/1086432 to your computer and use it in GitHub Desktop.
Save topherfangio/1086432 to your computer and use it in GitHub Desktop.
Eample of SC SelectAll
selectAllClicked: function(evt) {
/*
* Go ahead and deselect all objects first so that we don't confuse the user
*/
Pharos360.studentsController.selectObject();
/*
* Now, select only those students that aren't currently selected
*/
var students = Pharos360.filteredStudentsController.get('arrangedObjects');
var currentSelection = Pharos360.studentsController.get('selection');
var toSelect = [];
students.forEach(function(student) {
if (student && student.row && !currentSelection.containsObject(student)) {
toSelect.pushObject(student);
}
});
Pharos360.studentsController.selectObjects(toSelect, YES);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment