Template clarification on MultiSelectComponent -> CheckBoxSelection

Need Clarification upon below points

When using MultiSelectComponent -> CheckBoxSelection in this mode is set to CheckBox same behaviour is expected, 
but template which comes with mode box is expected with this mode how to achive this is there any option provided where both combination works together please let us know.

Below sample screen shot same template need to be achieved with mode CheckBox please assit on this




1 Reply

BC Berly Christopher Syncfusion Team April 15, 2020 02:02 PM UTC

Hi Sandeep, 

Greetings from Syncfusion support.  

We have prepared the custom sample for the requested requirement “Display the values same as in the box mode in the check box selection” and attached it below.  

export class CheckBox extends SampleBase { 
    constructor() { 
      super(...arguments); 
      //define the data with category 
      this.countries = [ 
        { Name: 'Australia'Code: 'AU' }, 
        { Name: 'Bermuda'Code: 'BM' }, 
        { Name: 'Canada'Code: 'CA' }, 
        { Name: 'Cameroon'Code: 'CM' }, 
        { Name: 'Denmark'Code: 'DK' }, 
        { Name: 'France'Code: 'FR' }, 
        { Name: 'Finland'Code: 'FI' }, 
        { Name: 'Germany'Code: 'DE' }, 
        { Name: 'Greenland'Code: 'GL' }, 
        { Name: 'Hong Kong'Code: 'HK' }, 
        { Name: 'India'Code: 'IN' }, 
        { Name: 'Italy'Code: 'IT' }, 
        { Name: 'Japan'Code: 'JP' }, 
        { Name: 'Mexico'Code: 'MX' }, 
        { Name: 'Norway'Code: 'NO' }, 
        { Name: 'Poland'Code: 'PL' }, 
        { Name: 'Switzerland'Code: 'CH' }, 
        { Name: 'United Kingdom'Code: 'GB' }, 
        { Name: 'United States'Code: 'US' } 
      ]; 
      // maps the appropriate column to fields property 
      this.checkFields = {text: 'Name'value: 'Code'};     
    } 
    onChange(args) { 
      if (this.mulObj.viewWrapper) { 
        this.mulObj.viewWrapper.style.display = 'none'; 
      } 
      this.mulObj.chipCollectionWrapper.style.display = 'block'; 
      let inputPos = this.mulObj.overAllWrapper.getBoundingClientRect() 
      let popupPos = this.mulObj.popupWrapper && this.mulObj.popupWrapper.getBoundingClientRect(); 
      if (inputPos && popupPos && (inputPos.top + inputPos.height > popupPos.top)) { 
        this.mulObj.popupWrapper.style.top = (inputPos.top + inputPos.height) + 'px'; 
      } 
    } 
    onSelect(args) { 
      this.mulObj.addChip(args.itemData.Nameargs.itemData.Codeargs.e); 
      var proxy = this; 
      setTimeout(function () { proxy.onChange(argsthis.mulObj) }, 50) 
    } 
    onCreate(args) { 
      this.mulObj.chipCollectionWrapper = this.mulObj.createElement('span', { 
        className: 'e-chips-collection', 
        styles: 'display:none' 
      }); 
      this.mulObj.componentWrapper.appendChild(this.mulObj.chipCollectionWrapper);  
    } 
    onFocus(args) { 
      this.mulObj.viewWrapper.style.display = 'none'; 
    } 
    onSelectedAll(args) { 
      this.mulObj.hidePopup(); 
    } 
    onRemoved(args) { 
      var proxy = this; 
      setTimeout(function () { proxy.onChange(argsthis.mulObj) }, 10) 
    } 
    render() { 
      return (<div id="multichecbox" className='control-pane'> 
        <div className='control-section col-lg-8'> 
          <div id="multigroup" className="control-styles"> 
            <h4>CheckBox</h4> 
            <MultiSelectComponent id='multiselect-checkbox' ref={(scope) => { this.mulObj = scope; }} dataSource={this.countriesfields={this.checkFieldsplaceholder="Select countries" mode="CheckBox" showSelectAll={true}  filterBarPlaceholder="Search countries" popupHeight="350px" change={this.onChange.bind(this)} select={this.onSelect.bind(this)} created={this.onCreate.bind(this)} focus={this.onFocus.bind(this)} selectedAll={this.onSelectedAll.bind(this)} removed={this.onRemoved.bind(this)}> 
              <Inject services={[CheckBoxSelection]} /> 
            </MultiSelectComponent> 
          </div> 
        </div> 
      </div>); 
    } 
  } 
   
  render(<CheckBox />, document.getElementById('sample')); 
 
  
Please find the sample from the below link. 
 

  
Regards, 
Berly B.C

Loader.
Up arrow icon