Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
143845 | Apr 8,2019 01:52 AM UTC | Apr 9,2019 11:04 AM UTC | jQuery | 3 |
![]() |
Tags: ejGrid |
<script type="text/javascript">
var ddldata;
$(function () {
// dataSource for Grid
var dataManager = ej.DataManager({
url: "Handler/Data.ashx",
adaptor: new ej.UrlAdaptor()
});
// dataSource for Dropdown element
var ddldataManager = ej.DataManager({
url: "Handler/ddlData.ashx",
adaptor: new ej.UrlAdaptor()
});
var query = ej.Query().take(5);
var execute = ddldataManager.executeQuery(query) // executing query
.done(function (e) {
ddldata = e.result; // store the value from ashx in global variable
});
var query = ej.Query().take(5);
var execute = dataManager.executeQuery(query) // executing query
.done(function (e) {
// bind the dropdown dataSource from the global varibale
$("#Grid").ejGrid({
dataSource: e.result,
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },
allowPaging: true,
columns: [{ field: "OrderID", isPrimaryKey: true },
{ field: "CustomerID" },
{ field: "EmployeeID", editType: ej.Grid.EditingType.Dropdown, dataSource: ddldata, editParams: { fields: { text: "EmployeeID", value: "EmployeeID" }, enableDistinct: true } },
{ field: "ShipCity" }
],
…………………………………………………………………………
});
});
}); |
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.