@@ -104,19 +104,26 @@ export class ComboBoxListItemPicker extends React.Component<IComboBoxListItemPic
104
104
/**
105
105
* On Selected Item
106
106
*/
107
- private onChanged = ( option ?: IComboBoxOption , index ?: number , value ?: string , submitPendingValueEvent ?: any ) : void => {
108
- if ( option && option . selected ) {
107
+ private onChanged = ( option ?: IComboBoxOption , index ?: number , value ?: string , submitPendingValueEvent ?: any ) : void => {
108
+ if ( this . props . multiSelect ) {
109
+ if ( option && option . selected ) {
110
+ this . selectedItems . push ( {
111
+ [ this . props . keyColumnInternalName || "Id" ] : option . key ,
112
+ [ this . props . columnInternalName ] : option . text ,
113
+ selected : option . selected
114
+ } ) ;
115
+ } else {
116
+ this . selectedItems = this . selectedItems . filter ( o => o [ this . props . keyColumnInternalName || "Id" ] !== option . key ) ;
117
+ }
118
+ } else {
109
119
this . selectedItems . push ( {
110
120
[ this . props . keyColumnInternalName || "Id" ] : option . key ,
111
- [ this . props . columnInternalName ] : option . text ,
112
- selected : option . selected
121
+ [ this . props . columnInternalName ] : option . text
113
122
} ) ;
114
- } else {
115
- this . selectedItems = this . selectedItems . filter ( o => o [ this . props . keyColumnInternalName || "Id" ] ! == option . key ) ;
123
+
124
+ this . selectedItems = this . selectedItems . filter ( o => o [ this . props . keyColumnInternalName || "Id" ] = == option . key ) ;
116
125
}
117
- this . props . onSelectedItem ( this . selectedItems . map ( item => ( {
118
- [ this . props . keyColumnInternalName || "Id" ] : item . key ,
119
- [ this . props . columnInternalName ] : item . text
120
- } ) ) ) ;
126
+
127
+ this . props . onSelectedItem ( this . selectedItems ) ;
121
128
}
122
129
}
0 commit comments