Add column and dropdownedit dynamically

Hello !

I want to be able to add Columns dynamically and dropdownedit also.  But I cannot succeed to see the list of values in the dropdown when I edit or add a row.

        <ejs-grid #grid [dataSource]='datat' [editSettings]='editSettings' [toolbar]='toolbar' height='272px' >

          [columns]='columns'>

        </ejs-grid>


  public data: any;

  public columns: Object[];

  public toolbar: ToolbarItems[];

  public editSettings: EditSettingsModel;

  ngOnInit() {

    this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog', showDeleteConfirmDialog: true };

    this.toolbar = ['Add', 'Edit', 'Delete'];

this.columns = [

      {

        field: 'Currency', editType: 'dropdownedit', width: 150,

        edit: { params: { query: new Query(), dataSource: [{ text: 'USD' }, { text: 'GBP' }, { text: 'EUR' }], fields: { text: 'text', value: 'text' } } }

      }

    ];

}


3 Replies 1 reply marked as answer

SK Sujith Kumar Rajkumar Syncfusion Team August 4, 2021 10:13 AM UTC

Hi Frédéric, 
 
Greetings from Syncfusion support. 
 
We checked the reported problem by creating a sample based on the shared code snippet but unfortunately were unable to reproduce it as the custom edit dropdown data source was displayed properly. You can check the below sample and image for reference, 
 
 
 
 
We suspect that you might be facing problem due to duplicate packages installed inside your application’s ‘@syncfusion’ package in the node modules folder. This might be invoking different package version files causing the reported problem. So please follow the steps provided below to overcome this,  
 
  • Delete package.lock.json file from your application.  
  • Remove the @syncfusion package folder from the node_modules.
  • Use latest version or “*”(Installs the latest packages) for all Syncfusion components in package.json file.  
  • Then install the NPM packages.
 
If problem still persists, then please share us the following information to validate further on this, 
 
  • Share us the entire column and Grid rendering code.
  • Share us sample data bound in the Grid.
  • If possible share us a simple sample to replicate the problem or try reproducing it in the above provided sample.
 
Regards, 
Sujith R 


Marked as answer

FR Frédéric August 4, 2021 10:49 AM UTC

Shame on me...


You was right !! 


thank you so much !



SK Sujith Kumar Rajkumar Syncfusion Team August 5, 2021 06:12 AM UTC

Hi Frédéric, 
 
You’re welcome. We are glad to hear that your query has been resolved. 
 
Regards, 
Sujith R 


Loader.
Up arrow icon