@{
var editParams = new { @params = new { dataSource = Model.Catergories, fields = new { text = "FundCategoryName", value = "FundCategoryID" } }};
}
|
@{
var numericEditParams = new { @params = new { min = 5, max = 10, step = 2 } };
}
<e-grid-column field="Weight" headerText="Weight" edit="numericEditParams" textAlign="Right" editType="numericedit"></e-grid-column>
|
var editParams = new Syncfusion.EJ2.DropDowns.DropDownList() {
DataSource = Model.Catergories,
Query = "new ej.data.Query()",
Fields = new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings() { Value = "FundCategoryID", Text = "FundCategoryName" }
};
|
<div>
<ejs-grid id="Grid" dataSource="ViewBag.DataSource" actionComplete="actionComplete" allowPaging="true" toolbar="@(new List<string>() {"Add", "Edit", "Delete", "Cancel", "Update"})">
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings>
...
</e-grid-columns>
</ejs-grid>
</div>
<script>
function actionComplete(args) {
if (args.requestType === "beginEdit")
var dropIns = document.getElementById("GridFundCategoryName").ej2_instances[0];
console.log(dropIns.dataSource);
}
</script> |
|
I cannot submit comment to this (see below message) so I've attached a word document with my comments.
You have tried to enter a word or URL that is not allowed on this site. If you believe that this is inaccurate, please contact us at support@syncfusion.com.
...
@{
var DropDownList = new Syncfusion.EJ2.DropDowns.DropDownList()
{
DataSource = ViewData["dropDownData"],
Query = "new ej.data.Query()",
Fields = new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings() { Value = "ShipCity", Text = "EmployeeID" }
};
}
<ejs-grid id="Grid" dataSource=@ViewData["dataSource"] allowPaging="true" toolbar="@(new List<string>() {"Add", "Edit", "Delete", "Update", "Cancel"})">
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" width="120"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer ID" width="150"></e-grid-column>
<e-grid-column field="EmployeeID" headerText="EmployeeID" width="130"></e-grid-column>
<e-grid-column field="ShipCity" headerText="ShipCity" editType="dropdownedit" edit="new {@params = DropDownList }" width="120"></e-grid-column>
</e-grid-columns>
</ejs-grid> |
Hi.
The sample provide does not work correctly. When editing a
row id is shown in the dropdown not text, see image.
It looks like EmployeeID and ShipCity is wrong in the
supplied sample. It should be Value=EmployeeID and Text=ShipCity? If I make
this change text is shown in dropdown but in the edited row the dropdown is
blank, it should show current selected item. When I select another row
dropdown shows EmployeeID not text? Does this sample really work on your side?
@{
var DropDownList = new Syncfusion.EJ2.DropDowns.DropDownList()
{
DataSource = ViewData["DropdownData"],
Query = "new ej.data.Query()",
Fields = new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings() { Value = "ShipCity", Text = "ShipCity" }
};
}
<div>
<ejs-grid id="Grid" allowPaging="true" actionBegin="actionBegin" allowSorting="true" allowFiltering="true" height="273" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
<e-data-manager url="/Home/GridDatasource" insertUrl="/Home/Insert" updateUrl="/Home/Update" removeUrl="/Home/Delete" adaptor="UrlAdaptor"></e-data-manager>
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Normal" showConfirmDialog="true" showDeleteConfirmDialog="true"></e-grid-editSettings>
<e-grid-pagesettings pageSize="7"></e-grid-pagesettings>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" textAlign="Right" width="120"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer ID" type="string" width="120"></e-grid-column>
<e-grid-column field="Freight" headerText="Freight" textAlign="Right" format="C2" editType="numericedit" width="120"></e-grid-column>
<e-grid-column field="ShipCity" headerText="ShipCity" editType="dropdownedit" edit="new {@params = DropDownList }" width="120"></e-grid-column>
</e-grid-columns>
</ejs-grid>
</div>
<script>
var EmployeeID;
var dropdowndata = @Json.Serialize(ViewData["DropdownData"]);
function actionBegin(args) {
if (args.requestType === "save") {
args.data['ShipID'] = dropdowndata.filter(function (d) { return d.ShipCity === args.data['ShipCity'] })[0].ShipID;
}
}
</script> |
public class OrdersDetails
{
public static List<OrdersDetails> order = new List<OrdersDetails>();
...
public int? OrderID { get; set; }
public string CustomerID { get; set; }
...
public int? ShipID { get; set; }
} |
|