<div id="Grid"></div>
<script type="text/javascript">
$(function () {
// the datasource "window.gridData" is referred from jsondata.min.js
var data = ej.DataManager(window.gridData).executeLocal(ej.Query().take(50));
$("#Grid").ejGrid({
dataSource: data,
allowPaging: true,
editSettings: {
allowAdding: true, allowEditing: true, editMode: ej.Grid.EditMode.InlineTemplateForm, inlineFormTemplateID: "#problemEntry" },
actionComplete: 'complete',
columns: [
{ field: "OrderID", headerText: "Order ID", width: 75 , textAlign: ej.TextAlign.Right },
{ field: "CustomerID", headerText: "Customer ID", width: 80 },
{ field: "EmployeeID", headerText: "Employee ID", width: 75, textAlign: ej.TextAlign.Right },
],
actionComplete: function (args) {
$(".e-pagercontainer.e-template").css('border-style', 'none');
$(".form").css('textAlign','left');
}
});
});
<script type="text/x-jsrender" id="problemEntry">
<input type="text" class="form" />
</script> |
<script type="text/javascript">
var temp = $.templates(problemEntry);
$(function () {
// the datasource "window.gridData" is referred from jsondata.min.js
var data = ej.DataManager(window.gridData).executeLocal(ej.Query().take(50));
$("#Grid").ejGrid({
actionComplete: 'complete',
editSettings: { allowAdding: true, allowEditing: true, editMode: ej.Grid.EditMode.InlineForm },
. . .
actionComplete: function (args) {
if (args.requestType == "beginedit" || args.requestType == "add") {
var datarow = args.requestType == "add" ? args.data : args.rowData;//get the row data
$("#GridEditForm").html(temp.render(datarow));
//$("#GridEditForm #test").ejNumericTextbox({ width: "116px", height:"34px", decimalPlaces: 2 });//rendering the input element to required control if needed
}
}
});
});
</script>
|