Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #113188
    Dark Beccio
    Participant

    Hi,

    Is there a way to use the grid’s <strong data-start=”33″ data-end=”44″>summary property with custom operations?<br data-start=”77″ data-end=”80″ />For example, calculating the <strong data-start=”109″ data-end=”154″>sum of the difference between two columns?<br data-start=”155″ data-end=”158″ />Thank you very much.

    #113201
    Markov
    Keymaster

    Hi,

    The summary of the column can be set to a function so it can calculate a custom summary.

    ` columns: [
    {
    label: ‘#’, width: 200, dataField: ‘id’
    },
    {
    label: ‘First Name’, dataField: ‘firstName’
    },
    { label: ‘Last Name’, dataField: ‘lastName’ },
    { label: ‘Product’, dataField: ‘productName’ },
    { label: ‘Quantity’, dataField: ‘quantity’, summary: [‘min’, ‘max’], align: ‘right’, cellsAlign: ‘right’, },
    { label: ‘Unit Price’, dataField: ‘price’, align: ‘right’, cellsAlign: ‘right’, cellsFormat: ‘c2’ },
    {
    label: ‘Total’, dataField: ‘total’, align: ‘right’, summary: ([{
    ‘Custom’: (currentValue, cellValue, dataField, data) => {
    return currentValue + cellValue
    }
    }]), cellsAlign: ‘right’, cellsFormat: ‘c2’
    }
    ]`

    Best regards,
    Markov

    Smart UI Team
    https://www.htmlelements.com/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.