GridCompoenent ColumnDirective dropdownedit Event

It isn't particularly clear how to listen to the change event of a ColumnDirective editType of dropdownedit

How do I do this?


1 Reply

JC Joseph Christ Nithin Issack Syncfusion Team March 23, 2022 02:19 PM UTC

Based on your query, you want to listen to the change event of the dropdown of a column for which the editType is set as dropdownedit. You can achieve your requirement by using the `column.edit` property of the EJ2 Grid where you can set the editparams of the dropdown.  

Please refer the below code example. 


xport class NormalEdit extends SampleBase { 
  constructor() { 
    super(...arguments); 
    this.toolbarOptions = ['Add''Edit''Delete''Update''Cancel']; 
    this.editSettings = { 
      allowEditing: true, 
      allowAdding: true, 
      allowDeleting: true, 
      newRowPosition: 'Top', 
    }; 
    this.editparams = { 
      params: { popupHeight: '300px'change: this.dropdownChange.bind(this) }, 
    }; 
    this.validationRule = { required: true }; 
    this.orderidRules = { required: truenumber: true }; 
    this.pageSettings = { pageCount: 5 }; 
    this.format = { type: 'dateTime'format: 'M/d/y hh:mm a' }; 
  } 
  dropdownChange(args) { 
    console.log(args); 
  } 
  actionBegin(args) {} 
  render() { 
    return ( 
      <div className="control-pane"> 
        <div className="control-section"> 
          <div className="col-md-9"> 
            <GridComponent 
              dataSource={orderDataSource} 
              ref={(grid=> (this.gridInstance = grid)} 
              toolbar={this.toolbarOptions} 
              allowPaging={true} 
              editSettings={this.editSettings} 
              pageSettings={this.pageSettings} 
              actionBegin={this.actionBegin.bind(this)} 
            > 
              <ColumnsDirective> 
                ------------------ 
                ------------------ 
                <ColumnDirective 
                  field="ShipCountry" 
                  headerText="Ship Country" 
                  width="150" 
                  editType="dropdownedit" 
                  edit={this.editparams} 
                ></ColumnDirective> 
              </ColumnsDirective> 
              <Inject services={[PageToolbarEdit]} /> 
            </GridComponent> 
          </div> 
        </div> 
      </div> 
    ); 
  } 
} 





Please get back to us for further details. 


Loader.
Up arrow icon