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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid will not manually populate value set as dropdownedit

Thread ID:

Created:

Updated:

Platform:

Replies:

143446 Mar 20,2019 01:01 PM UTC Mar 21,2019 08:45 AM UTC JavaScript - EJ 2 3
loading
Tags: Grid
Craig
Asked On March 20, 2019 01:01 PM UTC

Hi,

I need to manually set the values of the dropdown in an editable Grid. These are hardcoded values and will not come from the database. I am currently setting the code like this:

{
                        field: 'Currency',
                        width: 200,
                        params: {
                            dataSource: [{ text: 'USD' }, { text: 'GBP' }, { text: 'EUR' }],
                        },
                        editType: 'dropdownedit', 
                        headerText: 'Currency'


                    },


However the drop-down is just empty.

See video for replicated problem: http://www.youtube.com/watch?v=zt5lmckCvEk

Thanks

Craig




Thavasianand Sankaranarayanan [Syncfusion]
Replied On March 21, 2019 06:49 AM UTC

Hi Craig, 

Greetings from Syncfusion. 

Based on your query we suspect that you want to apply dataSource for the dropdown in Grid’s column. So, we suggest you to follow the below code example to achieve your requirement. 


ej.base.enableRipple(true); 
    var data = [{OrderID: 10248, CustomerID: "VINET", Freight: 32.38, Currency: 'USD'}, {OrderID: 10249, CustomerID: "TOMSP", Freight: 11.61, Currency:'USD'}]; 
 
    var grid = new ej.grids.Grid({ 
        dataSource: data, 
        editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal', newRowPosition:'Top' }, 
        
        toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'], 
 
        columns: [ 
            { 
                field: 'OrderID', isPrimaryKey: true, headerText: 'Order ID', textAlign: 'Right', 
                validationRules: { required: true, number: true }, width: 140 
            }, 
            { 
                field: 'CustomerID', headerText: 'Customer ID', 
                validationRules: { required: true }, width: 140 
            }, 
            { 
                field: 'Freight', headerText: 'Freight', textAlign: 'Right', editType: 'numericedit', 
                width: 140, format: 'C2', validationRules: { required: true } 
            }, 
            { 
                field: 'Currency',  editType: 'dropdownedit', width: 150, 
                edit: {  
                   params: {  
                       query: new ej.data.Query(),   
                       dataSource: [{ text: 'USD' }, { text: 'GBP'}, { text: 'EUR'}], 
                       fields:{text:'text',value:'text'}  
                   }  
                } 
            } 
        ], 
    }); 
    grid.appendTo('#Grid'); 


We have prepared a simple sample in the following stackblitz link. 


Refer the help documentation. 



Regards, 
Thavasianand S. 


Craig
Replied On March 21, 2019 07:22 AM UTC

That resolved the issue. I hadn't wrapped the params object inside an edit object


Thavasianand Sankaranarayanan [Syncfusion]
Replied On March 21, 2019 08:45 AM UTC

Hi Craig, 
 
We are happy that the problem has been solved. 
 
Please get back to us if you need any further assistance.  
                          
Regards, 
Thavasianand S.

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

;