syncfusion / ej2-vue-ui-components

Syncfusion Vue UI component library offer more than 50+ cross-browser, responsive, and lightweight vue UI controls for building modern web applications.
https://www.syncfusion.com/vue-ui-components
Other
298 stars 65 forks source link

MultiSelect #65

Closed Shi1996 closed 2 years ago

Shi1996 commented 3 years ago

Can the mode property of multiselect be realized by using both box and checkbox?

PonmaniMurugaiyan commented 3 years ago

Hi @Shi1996 ,

Yes, you can achieve your requirement by using Multiselect DropDown with mode CheckBox and displaying the values as Chip while selecting the items.

onChange: function(args){ 
  var multiSelectObj = this.$refs.multiSelectObj.ej2Instances; 
  if(multiSelectObj.viewWrapper){ 
      multiSelectObj.viewWrapper.style.display ='none'; 
  } 
  multiSelectObj.chipCollectionWrapper.style.display = 'block'; 
  let inputPos = multiSelectObj.overAllWrapper.getBoundingClientRect() 
  let popupPos = multiSelectObj.popupWrapper && multiSelectObj.popupWrapper.getBoundingClientRect(); 
  if (inputPos && popupPos && (inputPos.top + inputPos.height > popupPos.top)) { 
    multiSelectObj.popupWrapper.style.top = (inputPos.top + inputPos.height)+'px'; 
  } 
  }, 
onSelect: function(args){ 
  var multiSelectObj = this.$refs.multiSelectObj.ej2Instances; 
  multiSelectObj.addChip(args.itemData.Game,args.itemData.Id,args.e); 
  setTimeout(this.onChange,5) 
}, 
onCreated: function(){ 
  var multiSelectObj = this.$refs.multiSelectObj.ej2Instances;  
    multiSelectObj.chipCollectionWrapper = multiSelectObj.createElement('span', { 
          className: 'e-chips-collection', 
          styles: 'display:none' 
      }); 
      multiSelectObj.componentWrapper.appendChild(multiSelectObj.chipCollectionWrapper); 
      //multiSelectObj.value = ['Game1','Game2']; // You can set the preselect the value 
}, 
onFocus: function(args){ 
  document.getElementsByClassName('e-delim-view')[0].style.display ='none'; 
}, 
onSelectAll: function(args){ 
  var multiSelectObj = this.$refs.multiSelectObj.ej2Instances; 
  multiSelectObj.hidePopup(); 
}, 
onRemove: function(args){ 
  setTimeout(this.onChange, 5); 
}, 

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/quickstart-1582913320

Regards, Ponmani M

gsumankumar commented 2 years ago

We are closing this issue since there is no recent activity. Feel free to reopen this and update your comments for the reinvestigation.