Dropdown values on a datagrid

Hi guys,

I'm trying to set the dropdown values on my datagrid from a table on my database and I can't seem to do it.

I can make it work with a hard-coded list like in your online examples, and I can make it work with selecting a value from the table the grid populates, but either of these are suitable in my case - I need the user to pick a value from a list and I need that list to be based on a database table that another process maintains.

Below is as far as i can get, but it seems like the edit params takes the empty list (ie before the OnInitializedAsync fills it) and then doesn't pick up the changes.  

in my grid I have:
EditType="EditType.DropDownEdit" EditorSettings="@KeyWordTypeEditParams"

in the code is;

        public static List<NewsLinkEntityType> NewsLinkEntityTypes;

        public IEditorSettings KeyWordTypeEditParams = new DropDownEditCellParams
        {
            Params = new DropDownListModel<object, object>() { DataSource = NewsLinkEntityTypes, AllowFiltering = true }
        };

        protected override async Task OnInitializedAsync()
        {
            NewsLinkEntityTypes = await AlertDataServices.GetNewsLinkEntityTypes(); //database call to populate 
          }

Any help would be most appreciated.
       

2 Replies 1 reply marked as answer

RH Ralph Hope October 14, 2020 04:22 PM UTC

Nevermind, solved it :)  

It likes lists of the same object as the parent drowndown, but I can pass it a different list.

Marked as answer

RN Rahul Narayanasamy Syncfusion Team October 15, 2020 03:49 AM UTC

Hi Ralph, 
 
Greetings from Syncfusion. 
 
Thanks for the update. We are happy to hear that you have resolved your problem by yourself. 
 
Please get back to us if you need further assistance. 
 
Regards, 
Rahul 


Loader.
Up arrow icon