<script type="text/x-jsrender" id="template"> {{if Verified == "S" }} <div> Si </div> {{else}} <div> No </div> {{/if}} </script> <script type="text/javascript"> $(document).ready(function () { var element = $("#Grid"); element.ejGrid({ dataSource: [{ OrderID: 100, CustomerID: "SDSFH", Verified: "S" }, { OrderID: 101, CustomerID: "ASSFG", Verified: "N" }, ----------], allowPaging: true, editSettings: { allowEditing: true, allowAdding: true, allowDeleting: "true", editMode: "batch" }, columns: [ { field: "OrderID", isPrimaryKey: true, headerText: "Order ID", textAlign: ej.TextAlign.Right, width: 75 }, { field: "CustomerID", headerText: "Customer ID", width: 120 }, { field: "Verified", headerText: "Verified", template: "#template", width: 90, ----------------------------- } ] }); }); </script> |
element.ejGrid({ dataSource: [{ OrderID: 100, CustomerID: "SDSFH", Verified: "S" }, -------], allowPaging: true, editSettings: { allowEditing: true, allowAdding: true, allowDeleting: "true", editMode: "batch" }, ------------------------------- columns: [ --------------------------- { field: "Verified", headerText: "Verified", template: "#template", width: 90, editType: ej.Grid.EditingType.Boolean, textAlign: ej.TextAlign.Right, editTemplate: { create: function () { return "<input type='checkbox'>"; }, read: function (args) { var value = args.ejCheckBox("model.checked") ? "S" : "N" return value; }, write: function (args) { if (args.rowdata.Verified == "S") args.element.ejCheckBox({ checked : true }); else args.element.ejCheckBox({ checked: false }); } }, width: 90 } ] }); }); |