We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to hide combobox control on selection of value in another combobox

Thread ID:

Created:

Updated:

Platform:

Replies:

146770 Aug 19,2019 09:37 AM UTC Aug 21,2019 03:55 AM UTC React - EJ 2 1
loading
Tags: ComboBox
Amol Sonawane
Asked On August 19, 2019 09:37 AM UTC

how to hide combobox control on selection of specific value in another combobox

Narayanasamy Panneer Selvam [Syncfusion]
Replied On August 21, 2019 03:55 AM UTC

Hi Amol, 
 
Thanks for contacting Syncfusion support. 
 
 
As per your request we have hided the ComboBox control on value selection of another ComboBox control. Please refer the below code snippet, 

[index.js] 
export class Cascading extends SampleBase { 
    constructor() { 
        super(...arguments); 
        this.tempCountry = 'country'; 
        //define the country ComboBox data 
        this.countryData = data[this.tempCountry]; 
        this.tempState = 'state'; 
        //define the state ComboBox data 
        this.stateData = data[this.tempState]; 
        // maps the country column to fields property 
        this.countryFields = { value: 'CountryId', text: 'CountryName' }; 
        // maps the state column to fields property 
        this.stateFields = { value: 'StateId', text: 'StateName' }; 
    } 
    onChange() { 
       this.stateObj.inputWrapper.container.classList.add("e-hide"); 
       if(this.stateObj.inputWrapper.container.classList.contains("e-hide")){ 
           this.stateObj.inputWrapper.container.style.display ="none"; 
       } 
        
    } 
    onClose(){ 
       if(this.stateObj.inputWrapper.container.classList.contains("e-hide")){ 
          this.stateObj.inputWrapper.container.classList.remove("e-hide");  
        } 
    } 
 
 
    render() { 
        return (<div className='control-pane'> 
        <div className='control-section'> 
          <div id='cascade'> 
            <div style={{ paddingTop: '35px' }}> 
              <ComboBoxComponent id="countryList" dataSource={this.countryData} allowCustom={false} ref={(combobox) => { this.countryObj = combobox; }} popupHeight="auto" fields={this.countryFields} change={this.onChange.bind(this)}  close={this.onClose.bind(this)} placeholder="Select a country"/> 
            </div> 
            <div style={{ paddingTop: '35px' }}> 
              <ComboBoxComponent id="stateList" dataSource={this.stateData} allowCustom={false} ref={(combobox) => { this.stateObj = combobox; }} popupHeight="auto" fields={this.stateFields} placeholder="Select a state"/> 
            </div> 
       
          </div> 
        </div> 
         
      </div>); 
    } 
} 
 
Please find the sample below, 

 
Please let us know if you need any further assistance on this. 
 
Regards, 
Narayanasamy P. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon