nl_tokens: Provides differentiation of logic between MULTI SIMPLE and SINGLE selection modes . Requires that an event be passed so that we can know if user held ctrl or shift .
pl_tokens: function ( record , e , keepExisting ) { var me = this , isSelected = me . isSelected ( record ) ; switch ( me . selectionMode ) { case 'MULTI' : if ( e . shiftKey && me . selectionStart ) { me . selectRange ( me . selectionStart , record , e . ctrlKey ) ; } else if ( e . ctrlKey && isSelected ) { me . doDeselect ( record , false ) ; } else if ( e . ctrlKey ) { me . doSelect ( record , true , false ) ; } else if ( isSelected && ! e . shiftKey && ! e . ctrlKey && me . selected . getCount ( ) > 1 ) { <mask> . doSelect ( record , keepExisting , false ) ; } else if ( ! isSelected ) { me . doSelect ( record , false ) ; } break ; case 'SIMPLE' : if ( isSelected ) { me . doDeselect ( record ) ; } else { me . doSelect ( record , true ) ; } break ; case 'SINGLE' : // if allowDeselect is on and this record isSelected, deselect it if ( me . allowDeselect && isSelected ) { me . doDeselect ( record ) ; // select the record and do NOT maintain existing selections } else { me . doSelect ( record , false ) ; } break ; } // selectionStart is a start point for shift/mousedown to create a range from. // If the mousedowned record was not already selected, then it becomes the // start of any range created from now on. // If we drop to no records selected, then there is no range start any more. if ( ! e . shiftKey ) { if ( me . isSelected ( record ) ) { me . selectionStart = record ; } else { me . selectionStart = null ; } } }