This example demonstrates how to create an unbound column (Sum) that changes its values based on other column values dynamically in batch edit mode.
Follow the steps below:
-
Set the unbound column's ShowEditorInBatchEditMode property to
false
to make the column read-only in batch edit mode.settings.Columns.Add(column => { column.UnboundType = DevExpress.Data.UnboundColumnType.Decimal; column.FieldName = "Sum"; column.ReadOnly = true; column.Settings.ShowEditorInBatchEditMode = false; });
-
Handle the grid's client-side BatchEditEndEditing event. In the handler, recalculate column values based on the changes and call the SetCellValue method to set the new column value.
function OnBatchEditEndEditing(s, e) { var PriceColIndex = s.GetColumnByField("Price").index; var QuantityColIndex = s.GetColumnByField("Quantity").index; var priceValue = e.rowValues[PriceColIndex].value; var quantityValue = e.rowValues[QuantityColIndex].value; s.batchEditApi.SetCellValue(e.visibleIndex, "Sum", priceValue * quantityValue, null, true); }
(you will be redirected to DevExpress.com to submit your response)