New Product Launch - BoldDesk !
Introducing help desk ticketing software.
New Product LaunchBoldDesk: Help desk ticketing software starts at $10 for 3 agents.
Try it for free.
[index.cshtml]
@{
var datamng = ViewData["FNDataSource"];
}
@Html.AntiForgeryToken()
<ejs-grid id="Grid" allowPaging="true" load="onLoad" toolbar="@( new List<object>() {"Add","Edit","Delete","Update","Cancel"})">
<e-grid-editsettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Batch" newRowPosition="Bottom"></e-grid-editsettings>
<e-data-manager url="/Index?handler=DataSource" batchUrl="/Index?handler=BatchUpdate" adaptor="UrlAdaptor"></e-data-manager>
<e-grid-pageSettings pageCount="5" pageSize="5"></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" textAlign="Right" editType="stringedit" width="120" ></e-grid-column>
<e-grid-column field="ShipCity" headerText="Ship City" foreignKeyField="ShipCity" foreignKeyValue="FirstName" dataSource=datamng textAlign="Right" width="120" edit="@(new {create = "onCreate", read = "onRead", write = "onWrite", destroy= "onDestroy"})"></e-grid-column>
<e-grid-column field="EmployeeID" headerText="Employee ID" textAlign="Right" width="120"></e-grid-column>
</e-grid-columns>
</ejs-grid>
<script>
var elem;
var autoCompObj;
function onCreate(args) {
elem = document.createElement('input');
return elem;
}
function onRead(e) {
return autoCompObj.value;
}
function onDestroy() {
autoCompObj.destroy();
}
function onWrite(args) {
autoCompObj = new ej.dropdowns.AutoComplete({
value: args.rowData['ShipCity'],
dataSource: new ej.data.DataManager({
url: '/Index?handler=ChildDataSource',
adaptor: new ej.data.UrlAdaptor(),
crossDomain: true,
headers: [{ 'XSRF-TOKEN': $("input:hidden[name='__RequestVerificationToken']").val() }]
}),
fields: { value: 'ShipCity', text: 'FirstName' },
});
autoCompObj.appendTo(elem);
}
}
</script> |