Every line of 'select2 remove selected' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
45 public deSelect(item) { 46 const index = this.value.indexOf(item.text); 47 if (index >= -1) { 48 this.value.splice(index, 1); 49 } 50 this.result.emit(this.value); 51 }
92 removeOption(selectObj, AtIndex) { 93 const fullResponse = { 94 resultFlag: false, 95 details: '' 96 }; 97 if (AtIndex !== -1) { 98 selectObj.rows.splice(AtIndex, 1); 99 fullResponse.resultFlag = true; 100 fullResponse.details= ''; 101 return fullResponse; 102 } else { 103 fullResponse.resultFlag = false; 104 fullResponse.details= 'Option index not valid'; 105 return fullResponse; 106 } 107 }
187 function removeMultiSelect(target){ 188 //ie chokes if we just remove the div so we need to empty it first 189 $jq("#cascadingMulti_" + target).empty(); 190 $jq("#cascadingMulti_" + target).remove(); 191 $jq(".addMultiSelect" + target.split("_")[0]).last().show(); 192 removeAllMultiSelectionsFor( target ); 193 }
66 getSelectedOption(key) { 67 return this.$refs.select2.options[this.selectedIndex()].dataset[key]; 68 }
292 removeMultipleChoice (index, event) { 293 if (this.props.multiple) { 294 event.stopPropagation() 295 const optionChosen = this.state.optionChosen // 选项的下标 296 let indexInArr = 0 297 optionChosen.forEach((item, i) => { 298 if (index === item) { 299 indexInArr = i 300 } 301 }) 302 optionChosen.splice(indexInArr, 1) 303 // this.mulOptionChosen.splice(indexInArr,1) 304 const selected = optionChosen.length <= 0 ? false : true 305 this.setState({ 306 optionChosen, 307 selected 308 }) 309 let returnValue: any[] = [] 310 optionChosen.forEach((item) => { 311 const child = this.propsSelectOption[item] || {} 312 const value = child.props.value 313 const label = child.props.label 314 returnValue = this.prepareReturnValue(returnValue, value, label) 315 }) 316 this.props.onChange && this.props.onChange(returnValue) 317 } 318 }
520 function deleteSelected(param) { 521 if (param.firstTime) { 522 return sbgnFiltering.deleteSelected(); 523 } 524 return addRemoveUtilities.removeElesSimply(param.eles); 525 }
6 function removeSel(str) { 7 var elSel= document.getElementsByName(str)[0]; 8 if(elSel.selectedIndex>=0){ 9 elSel.remove(elSel.selectedIndex); 10 }else{ 11 alert("Please select one item to remove."); 12 } 13 }
32 removeSelection(selection, keepOperators = false) { 33 if (selection.first.parent === this && selection.last.parent === this) { 34 const nodes = [...selection]; 35 36 for (const node of nodes) { 37 this.remove(node); 38 } 39 40 if (!keepOperators) { 41 if (this.first.type === 'Operator') { 42 this.remove(this.first); 43 } 44 if (this.last.type === 'Operator') { 45 this.remove(this.last); 46 } 47 48 let duplicateOperator = null; 49 let i = 0; 50 for (const node of this.children) { 51 if (i++ % 2 === 0 && node.type === 'Operator') { 52 if (!duplicateOperator) { 53 duplicateOperator = node; 54 } 55 } 56 } 57 if (duplicateOperator) { 58 this.remove(duplicateOperator); 59 } 60 } 61 } 62 }
112 removeSelected(listItem) { 113 let index = this.selected.indexOf(listItem); 114 if (index > -1) { 115 this.selected.splice(index, 1); 116 this.available.push(listItem); 117 this._deselectOption(listItem.dataset.id); 118 this.redraw(); 119 120 setTimeout(() => { 121 let event = document.createEvent("HTMLEvents"); 122 event.initEvent("removed", false, true); 123 event.removedElement = listItem; 124 this.dualListbox.dispatchEvent(event); 125 }, 0); 126 } 127 }