<script type="text/template" id="template"> <b>Details</b> <div style="margin: 5px; width: 400px; height: 400px;"> <ej-grid id="GridDetail" locale="de-DE" action-complete="complete" action-begin="begin" enable-persistence="false" column-layout="Fixed"> <e-datamanager url="/Admin/Company/Data" update-url="/Admin/Company/Edit" insert-url="/Admin/Company/Insert" remove-url="/Admin/Company/Delete" adaptor="UrlAdaptor" /> <e-columns> <e-column field="id" type="Numeric" is-primary-key="true" is-identity="true" default-value="0" allow-editing="false" header-text="DB-ID" header-text-align="@TextAlign.Center" text-align="Right" width="@("10%")" visible="false"></e-column> <e-column field="name" validation-rules='@(new Dictionary<string,object> { {"required",true}, {"minlength",3} })' type="String" header-text="Betrieb" header-text-align="@TextAlign.Center" text-align="Left" width="250"></e-column> </e-columns> </ej-grid> </div> </script>
|
<ej-grid id="FlatGrid" allow-paging="true" action-complete="complete">
. . . .
function complete(args) {
if ((args.requestType == "beginedit" || args.requestType == "add") && args.model.editSettings.editMode == "dialogtemplate") {
$("#Freight").ejNumericTextbox({ value: parseFloat($("#Freight").val()), width: "116px", height: "28px", decimalPlaces: 2 });
$("#ShipCountry").ejDropDownList({ width: '116px' });
if (args.requestType == "beginedit") {
$("#OrderID").attr("disabled", "disabled");
$("#ShipCountry").ejDropDownList("setSelectedValue", args.row.children().eq(4).text());
}
}
$("#FlatGrid_dialogEdit").ejDialog({
open: function (args) { // bind dialog open event
var div = document.createElement('div'); // create div element
div.id = 'Grid'; // set id to the element
document.getElementById('FlatGrid_dialogEdit').appendChild(div); // append the div element inside the dialog.
var Data = [
{ OrderID: 10248, CustomerID: 'VINET', EmployeeID: 1, Employee: { Address: '507 - 20th Ave. E.Apt. 2A' }, Freight: 33.38, ShipName: 'Alfreds Futterkiste', ShipCountry: 'Brazil' },
. . . .
$(function () {
$("#Grid").ejGrid({ // render th grid using Javascript
dataSource: Data,
allowPaging: true,
|
|
<ej-grid id="FlatGrid" allow-paging="true" allow-filtering="true"action-complete="actionComplete" action-begin="actionBegin" >
<e-edit-settings allow-adding="true" allow-editing="true" allow-deleting="true" edit-mode="DialogTemplate" dialog-editor-template-id="template"></e-edit-settings>
</e-columns>
</ej-grid>
partialView:-
<div id="template">
<b>Order Details</b>
<table cellspacing="10">
<tr>
<td style="text-align: right;">
Order ID
<td style="text-align: left">
@{Html.EJ().AutocompleteFor(o => o.OrderID).CssClass("e-field valid").Render(); }
</td>
. . .
<td style="text-align: left">
@{Html.EJ().Grid<OrdersController>("FlatGrid1")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.AllowPaging()
.AllowTextWrap()
.TextWrapSettings(wrap => { wrap.WrapMode(WrapMode.Both); })
}).Render();
}
</td>
</tr>
</table>
</div>
@Html.EJ().ScriptManager()
<script>
function actionBegin(args) {
if (args.requestType == "save")
this.element.ejWaitingPopup("show");
}
function actionComplete(args) {
var type = args.requestType;
var OrderID = this.model.currentViewData[args.rowIndex]["OrderID"];
this.element.ejWaitingPopup("show");
$.ajax
({
url: "/Home/Index1",
type: "GET",
data: { value: OrderID },
success: ej.proxy(function (data) {
var div = ej.buildTag("div");
$("#" + this._id + "EditForm").prepend($(div).html(data))
. . .
}, this)
});
}
if (args.requestType == "save")
this.element.ejWaitingPopup("hide");
}
</script>
|
Hi Michael ,
Thanks for your update. Please get back to us if you need
any further assistance.
Regards,
Farveen sulthana T