<ej:Grid ID="Grid1" AllowPaging="True" Locale="en-US" runat="server"> <Columns> <ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" TextAlign="Right" Width="90" />
<ej:Column Field="CustomerID" HeaderText="Customer ID" Width="100">
<EditTemplate Create="create" Read="read" Write="write" />
</ej:Column>
<ej:Column Field="EmployeeID" HeaderText="Employee ID" HeaderTemplateID="#employeeTemplate" TextAlign="Right" Width="110" /> <ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="90" Format="{0:C}" /> <ej:Column Field="OrderDate" HeaderText="Order Date" Width="100" HeaderTemplateID="#dateTemplate" TextAlign="Right" Format="{0:MM/dd/yyyy}" /> <ej:Column Field="ShipCity" HeaderText="Ship City" Width="100" /> </Columns> <PageSettings PageSize="15" /> <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings> <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings> <SelectionSettings EnableToggle="true" /> </ej:Grid>
<Script section> <Create> function create() { return $("<input style='text-transform: uppercase'>"); }
<WRITE> function write(args) { obj = $('#MainContent_Grid1').ejGrid('instance'); var data = ej.DataManager(obj.model.dataSource).executeLocal(new ej.Query().select("CustomerID"));
args.element.ejAutocomplete({ width: "100%", dataSource: data, enableDistinct: true, value: args.rowdata !== undefined ? args.rowdata["CustomerID"] : "", }); } <READ> function read(args) { args.ejAutocomplete('suggestionList').css('display', 'none');
return args.ejAutocomplete("getValue"); }
$("#MainContent_Grid1").keyup(function (e) {
if (e.keyCode == 40 && $(e.target).hasClass("e-autocomplete")) { var autocomp = $("#MainContent_Grid1CustomerID").ejAutocomplete("instance")
if (autocomp._getActiveText() != "No suggestions") $(e.target).val(autocomp._getActiveText()); } }); |