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. Image for the cookie policy date

Child grid DropDownEditCell datasource not working

I am trying to bind a datasource to DropDownEditCell but it does not working. Please help. I am setting edit.params with the dataSource though its working for placeholder but not for the dataSource. All the other cell types are working (NumericEditCell, DataPickerEditCell etc).

public errorGridActionBegin(argsanycontextany) {

    if (args.requestType == 'beginEdit') {
      let editCellTypeObject = {
        'dropdownedit': DropDownEditCell'numericedit': NumericEditCell,
        'datepickeredit': DatePickerEditCell'defaultedit': DefaultEditCell,
        'comboboxedit': ComboboxEditCell
      }
      let colColumn = context.getColumnByField('correctedData');
      let validation = context.context.dataFileFields.find(_ => _.propertyName == args.rowData.field);
      if (validation != undefined) {

        col.validationRules = {
          range: [validation.rangeMinvalidation.rangeMax]
        }
      }
      if (args.rowData.field == 'PointId') {
        col.editType = 'dropdownedit';
        //col.dataSource = context.context.points;
        /*
        col.edit.params = {
          dataSource: context.context.points,
          fields: { value: 'type', text: 'type' }
        }; 
        */
       
        
       /* col.edit.params = {
          dataSource: ['test 1', 'test 2'],
          placeholder: 'arjuna',
          value: args.rowData.correctedData
        };*/


      } else {
        col.editType = 'numericedit';
      }


      col.edit.params = {
        dataSource: ['test 1''test 2'],
        placeholder: 'arjuna'
        
      };
      col.edit = extend(
        new editCellType[col.editType && editCellType[col.editType] ?
          col.editType : 'defaultedit'](contextcontext.serviceLocator),
        col.edit || {});
      
     
        
      
      /*col.edit.params = {
        min: 0,
        max: 10
      }*/

      /*col.validationRules = {
        range: [0,10]
      }*/
      
    }
  }

Attachment: editdropdown_a4f8380b.zip

1 Reply

PS Pavithra Subramaniyam Syncfusion Team November 14, 2019 11:14 PM

Hi Arjuna , 
 
Thanks for contacting Syncfusion support. 
 
Query :  I am trying to bind a datasource to DropDownEditCell but it does not working.  
 
We have validated the provided details. To use custom datasource in the DropDownList we must include Query property in the edit params. Please refer the below code example documentation for information. 
 
 
@Component({ 
    selector: 'app-root', 
    template: `<ejs-grid [dataSource]='data' [editSettings]='editSettings'  [toolbar]='toolbar' height='273px'> 
                <e-columns> 
                 <e-column field='ShipCountry' headerText='Ship Country' editType='dropdownedit' [edit]='ddParams'  width=150></e-column> 
                </e-columns> 
                </ejs-grid>` 
}) 
export class AppComponent implements OnInit { 
 
    public data: Object[]; 
    public editSettings: EditSettingsModel; 
    public toolbar: ToolbarItems[]; 
    public ddParams: IEditCell; 
    ngOnInit(): void { 
        this.data = data; 
        this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true }; 
        this.toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel']; 
        this.ddParams = { params: {dataSource: ['test 1', 'test 2'],query: new Query(),placeholder: 'arjuna' } }; 
    } 
    } 
} 
 
 
 
Please get back to us, if you need further assistance. 
 
Regards, 
Pavithra S. 


Loader.
Live Chat Icon For mobile
Up arrow icon