Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148698 | Oct 30,2019 03:37 PM UTC | Nov 4,2019 08:42 AM UTC | ASP.NET Core - EJ 2 | 4 |
![]() |
Tags: DataGrid |
<ejs-grid id="Grid" allowPaging="true" dataSource="@ViewBag.DataSource" toolbar="@(new List<string>() {"Add", "Edit", "Delete", "Cancel", "Update"})">
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Batch"></e-grid-editSettings>
<e-grid-columns>
. . . .
<e-grid-column allowSorting="true" field="Freight" headerText="Freight" validationRules="@(new { required=true})" Format="p0" textAlign="Right" editType="numericedit" width="120" edit="@(new {create = "create", read = "read", destroy = "destroy", write = "write"})"></e-grid-column>
</e-grid-columns>
</ejs-grid>
<script>
var elem;
var dObj;
function create(args) {
elem = document.createElement('input');
return elem;
}
function write(args) {
debugger
dObj = new ej.inputs.NumericTextBox({
value: args.rowData.Freight * 100, // maintain the value in format
format: "p0",
step: 10,
min: 0,
max: 6000
});
dObj.appendTo(elem);
document.getElementById('GridFreight').addEventListener('blur', formBlur);
}
function destroy() {
dObj.destroy();
}
function read(args) {
return dObj.value;
}
formBlur = function () {
this.ej2_instances[0].value = this.ej2_instances[0].value / 100;
}
</script> |
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.