Hi Gian,
Thanks for using Syncfusion products.
As from your query, we suspect that would you like to change the grid datasource dynamically if so, we can change the Grid data source like as follows,
|
function buttonClick(args) {
var gridObj = document.getElementById("Grid").ej2_instances[0];
gridObj.dataSource = //here we can assign the dynamic data source
}
|
Else if you want to bound the external data source for specific column with Dropdown edit type as well as enabling the search option for this. If So,
|
@Html.EJS().Grid("NormalEdit").DataSource((IEnumerable<object>)ViewBag.datasource).Columns(col =>
{
. . .
col.Field("ShipCountry").HeaderText("Ship Country ").Width("120").Edit(new { create="create", write="write", read="read" , destroy="destroy"}).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
. . .
}).AllowPaging().PageSettings(page => page.PageCount(2)).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Normal); }).Toolbar(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" }).Render()
[edit template]
function create() {
elem = document.createElement('input'); // create a input element
return elem;
}
function read(args) {
return dropdown.value;
}
function write(args) {
dropdown = new ej.dropdowns.DropDownList({
dataSource: data, //assign a new DataSource
fields: { text: "ShipCountry", value: "ShipCountry" },
//enable the search operation for Dropdown
allowFiltering: true,
placeholder:"Select a CustomerID",
value: args.rowData.CustomerID //selected data
dropdown.appendTo(elem);
}
|
Please refer to the following help documentation for more information,
If we misunderstood your requirement, then could you please share detailed information and scenario for more information? It would be helpful for us to find the problem and provide the better solution as earliest.
Regards,
Venkatesh Ayothiraman.