Skip to content

DevExpress-Examples/asp-net-mvc-grid-dynamic-calculation-in-batch-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grid View for ASP.NET MVC - How to calculate values dynamically in batch edit mode

This example demonstrates how to create an unbound column (Sum) that changes its values based on other column values dynamically in batch edit mode.

Calculate values on dynamically

Overview

Follow the steps below:

  1. 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;
    });
  2. 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);
    }

Files to Review

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Create an unbound column that changes its values based on other column values dynamically in batch edit mode.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy