BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
<ej-grid id="FlatGrid" allow-paging="true" cell-save="onCellSave"> <e-datamanager json="ViewBag.dataSource" batch-url="BatchUpdate" adaptor="remoteSaveAdaptor" /> <e-edit-settings allow-adding="true" allow-editing="true" allow-deleting="true" edit-mode="@(EditMode.Batch)"></e-edit-settings> <e-columns> <e-column header-text="temp" template="<span>{{:EmployeeID + Freight }}</span>" /> . . . . . </e-columns> </ej-grid> <script> function onCellSave(args) { if(args.columnName == "mployeeID" || args.columnName == "Freight"){ if(args.columnName == "EmployeeID" ) $(args.cell.closest("tr")).find(".e-templatecell span").text(args.value + args.rowData.Freight); else $(args.cell.closest("tr")).find(".e-templatecell span").text(args.value + args.rowData.EmployeeID); } } </script> |
<ej-grid id="FlatGrid" allow-paging="true" cell-save="onCellSave" before-batch-save="beforeSave"> <e-datamanager json="ViewBag.dataSource" batch-url="BatchUpdate" adaptor="remoteSaveAdaptor" /> .. . . . . </ej-grid> <script> function beforeBatchSave(args) { args.batchChanges.changed.push({ OrderID: 300, EmployeeID: 300 }) //these newly added records were found in the server } </script> |
Thanks Seeni.
My current calculated column is like below, adding <span> tag in the template makes the cells display "$NaN"
<e-column field="TotalPrice" header-text="Total Price" format="{0:C2}" template="{{:Volume * UnitPrice }}" allow-editing="false" text-align="Right" width="15"></e-column>
I just figured it out myself, I am posting my solution here in case it may help others.
Change find(".e-templatecell span") to find(".e-templatecell") will make the code to locate the proper cell without <span> tag. Then I need to add a currency formatter in the javascript code as the format defined in the e-column does not work on the value calculated in the script.
function onCellSave(args) {
if (args.columnName == "Volume" || args.columnName == "UnitPrice") {
var formatter = new Intl.NumberFormat('en-NZ', {
style: 'currency',
currency: 'NZD',
minimumFractionDigits: 2,
});
if (args.columnName == "Volume")
$(args.cell.closest("tr")).find(".e-templatecell").text(formatter.format(args.value * args.rowData.UnitPrice));
else $(args.cell.closest("tr")).find(".e-templatecell").text(formatter.format(args.value * args.rowData.Volume));
}
}