function complete(args) { if (args.requestType == "add" || args.requestType == "beginedit") { var currentRow = args.model.currentViewData[args.rowIndex]; $("#VendorID").ejDropDownList({ width: '116px', dataSource: args.model.columns[2].dataSource, fields: { text: "VendorName", value: "VendorID", id: "VendorID" } }); .......
if (args.requestType == "beginedit") { var currentRow = args.model.currentViewData[args.rowIndex]; $("#InvoiceGrid_dialogEdit").ejDialog({ title: "Details of " + currentRow.InvoiceNumber }); $("#VendorID").ejDropDownList("setSelectedValue", args.currentRow.columns[2].text()); .....
Could you give me some indication of what I'm doing wrong?
Many thanks
<style> .e-grid .e-columnheader .e-headercelldiv { height: Auto; white-space: normal; word-wrap: break-word; margin-top: 0px; margin-bottom: 2px; line-height: 18px; } |
@(Html.EJ().Grid<object>("FlatGrid") .Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.dataSource).UpdateURL("DialogUpdate").InsertURL("DialogInsert").RemoveURL("DialogDelete").Adaptor(AdaptorType.RemoteSaveAdaptor)) .AllowPaging() .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.DialogTemplate).DialogEditorTemplateID("#template"); }) .ToolbarSettings(toolbar => { toolbar.ShowToolbar().ToolbarItems(items => { items.AddTool(ToolBarItems.Add); items.AddTool(ToolBarItems.Edit); items.AddTool(ToolBarItems.Delete); items.AddTool(ToolBarItems.Update); items.AddTool(ToolBarItems.Cancel); }); }) .Columns(col => { col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add(); col.Field("EmployeeID").HeaderText("Employee Name").ForeignKeyField("EmployeeID").ForeignKeyValue("FirstName").DataSource((IEnumerable<object>)ViewBag.dataSource2).Width(23).Add(); col.Field("Freight").HeaderText("Freight").Format("{0:C}").Width(110).Add(); col.Field("CustomerID").HeaderText("Customer ID").Width(40).Add(); }) .ClientSideEvents(eve => { eve.ActionComplete("edit"); }) ) <script type="text/javascript"> var data = @Html.Raw(Json.Encode(ViewBag.dataSource2)); function edit(args) { if (args.requestType == "beginedit" || args.requestType =="add") { var DropDownListObj = $('#EmployeeID').ejDropDownList({ dataSource: data, width: "116px", fields: { id: "EmployeeID", text: "FirstName", value: "EmployeeID" } }).data("ejDropDownList"); if(args.requestType == "beginedit") DropDownListObj.selectItemByValue(this.getSelectedRecords()[0].EmployeeID); } } |
Hi Park,
We are happy to hear that your issue has been resolved.
Also, please let us know if you require any further assistance on this.
Regards,
J.Mohammed Farook