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

Editing Columns with Dropdown

Hello!

I want to be able to edit some columns in my Gantt Chart with a Dropdown.
However, I seem to be unable to find any documentation on how to do that.
I've found a forum post on how to do that with the Grid Control, but that doesn't seem to work for the Gantt Column,
the Dropdown just stays empty if I follow the syntax in the forum post.
If I try different syntax, the Dropdown fills with all the different values that are present in the Gantt Tasks for that specific column.

Here's a condensed Version of one of the things I tried:

<e-gantt-column field="@nameof(TermineModel.Name)"
headerTemplate="#nameTemplate"
width="100"
editType="dropdownEdit"
edit="@(new { @params = new {
                                                  dataSource = new List<object>() { new { value = "test", text = "test" },new { value = "test2", text = "test2" } },
                                                  fields = new { text = "text", value = "value" }
                                                       } })">
</e-gantt-column>

Please Advise.

Thank you




4 Replies

LK Lukas Knapp December 17, 2019 08:39 AM

Update:

Found out that the method I was using is actually working.... Sort of.
Thing is, the Dropdown only works in the Edit Modal, not when trying to inline-edit in the columns.
I do want inline-editing though, so help is still appreciated.


PP Pooja Priya Krishna Moorthy Syncfusion Team December 18, 2019 03:55 AM

Hi Lukas, 
 
We can load the custom data in dropdown by using the edit.params property. While setting the data source using edit params, it is necessary to initialize the query property also. 
Please find the below code example. 
 
 
@{ 
 
    var DropDownList = new Syncfusion.EJ2.DropDowns.DropDownList() { 
        DataSource = new List<object>() { new { value = "test", text = "test" }, new { value = "test2", text = "test2" } }, 
        Query = "new ej.data.Query()", 
        Fields = new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings() { Text = "text", Value = "value" }, 
    }; 
} 
<ejs-gantt id='Gantt' dataSource="ViewBag.DataSource" > 
    //... 
   <e-gantt-columns> 
        //... 
        <e-gantt-column field="Custom" editType="dropdownedit" 
                        edit="new {@params = DropDownList }"> 
        </e-gantt-column> 
    </e-gantt-columns> 
</ejs-gantt> 
 

Please get back to us if you require further assistance on this. 
Note: For security purpose, we have removed bin and obj folder in the shared sample. 

Regards, 
Pooja Priya K. 



LK Lukas Knapp December 18, 2019 04:48 AM

Hi!

After Setting the Query and explicitly creating instances of DropDownList and DropDownListFieldSettings instead of using anonymous types, it worked.

Thanks for the help!

Kind Regards

Lukas


PP Pooja Priya Krishna Moorthy Syncfusion Team December 18, 2019 11:40 PM

Hi Lukas, 
We are happy that your issue has been resolved. Please get back to us if you require further assistance on this. 
As always we will be happy to assist you. 

Regards, 
Pooja K. 


Loader.
Live Chat Icon For mobile
Up arrow icon