Hi Michael,
Thanks for contacting Syncfusion support.
We have analyzed your query and based on that we have prepared a sample that can be downloaded from the below link.
By default when adding the records in grid it will show the blank value for the dropdown columns and if user doesn’t select anything it will remains blank value. Suppose, if you set DefaultValue property for that particular column then it will shows that value while adding a record.
To show the dropdown value as blank value or null we suggest you to pass the empty data to the dropdown datasource initially when binding or by using addItem method in dropdown(when DefaultValue is set). Using selectItemByText we can able to make the dropdown value as null when user doesn’t select any items.
Please refer the below code example.
[index.cshtml]
@(Html.EJ().Grid<MVCSampleBrowser.Models.EditableOrder>("Grid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.AllowPaging()
... .ClientSideEvents(eve => eve.ActionComplete("complete"))
.Columns(col =>
{
...
})
)
<script>
function complete(args) {
if (args.requestType == 'add') {
var dropdown = $("#GridEmployeeID").ejDropDownList("instance");
$('#GridEmployeeID').ejDropDownList("addItem", { text: "" });
dropdown.selectItemByText("");
}
}
</script>
|
From the above code example, we have pass the empty data to the dropdown datasource for the particular column and by using selectItembyText or index we can get the blank value in dropdown.
Please refer the documentation link.
If you still face the issue please get back to us with the following details,
1. Share the screenshot of the issue that you have faced.
2. Share the full grid code.
3. Share the datasource for the dropdown.
4. If possible please reproduce the issue in the above attached sample.
The provided information will help us to analyze the issue and provide you the response as early as possible.
Please let us know if you need further assistance.
Regards,
Manisankar Durai.