Our blazing fast Grid component built with pure JavaScript


Post by sanid »

Hi guys,

I have some questions...

  1. Am I allowed to use Grid component as a standalone from Brynthum Scheduler package ( my company bought Brynthum Scheduler Licence) if not thats fine I will just order it.
  2. I am trying to build specific Grid that is grouping items based on date
    Group header should calculate min and max, and sum on come columns and I implemented that with summaryRenderer config and sum property for column.
    Problem is that I need to display custom footer in here
    features: { summary : true }

So now concrete question:
Is it posible to differentiate between group header summary call of summaryRenderer method and footer summary call to the same method?
Result should ommit some sum columns in footer...

This is reproducable here:
https://www.bryntum.com/examples/grid/aggregation-column/

Grid header group summary.PNG
Grid header group summary.PNG (83.78 KiB) Viewed 774 times

As always many thanks and keep up the good work :)


Post by alex.l »

  1. Grid component is a separately licensed product.
  2. Not sure I got the question if it's already implemented in the example you mentioned.
    It may be reached using https://bryntum.com/docs/grid/api/Grid/column/AggregateColumn to show summaries in headers, and https://bryntum.com/docs/grid/api/Grid/feature/Summary to show totals on bottom tbar. If you don't specify summaryRenderer and summaries for a column, then that column will be skipped. If you don't need group summary for a column in group header, don't specify that column type as aggregate.

Did I misunderstood you?

All the best,
Alex


Post by sanid »

Hi Alex,

Thanks for Info, will order another Licence as well...

I just want to hide some summary columns in the footer (on the picture marked as number 2).
For example, 3 last icons in the bottom.

So my problem is that summaryRenderer is called for group header summary (on the picture marked as number 1), and total grid summary in the footer as well (on the picture marked as number 2).

summaryRenderer : (column) => this.getMealIcon2(column, 'restaurant')

and summaryRenderer gets this column object that I cannot use to diffrerentiate between two render calls ( one in footer and another in group header)

summaryRenderer.PNG
summaryRenderer.PNG (7.4 KiB) Viewed 765 times

Post by alex.l »

To hide summary in the footer and leave it in header only, try to use https://bryntum.com/docs/grid/api/Grid/column/AggregateColumn column type for that column and do not specify any summaryRenderer/summaries. Check https://www.bryntum.com/examples/grid/aggregation-column/

Example:

columns : [
        {
            type   : 'aggregate',
            text   : 'Price',
            field  : 'price',
            flex   : 1,
            format : {
                locale      : 'en-US',
                template    : '$9,999',
                currency    : 'USD',
                significant : 5
            }
        },

it will show summary in group header and nothing in footer

All the best,
Alex


Post by sanid »

Hi Alex,
I am one step closer with sum method but how can I detect if sum method is called from footer?
I tried using following properties but no luck:
isGroupFooter, isGroupHeader, isLeaf, isSpecialRow, isParent, isChild, childLevel
sum : (sum, record) => record.descendantCount


Post by alex.l »

In case of using AggregateColumn, header values won't be driven by sum method, only footer values.
Header values is driven by format config and function method that defined the logic of calculations.
https://bryntum.com/docs/grid/api/Grid/column/AggregateColumn#config-function
https://bryntum.com/docs/grid/api/Grid/column/AggregateColumn#config-format

        {
            id     : 'total',
            type   : 'aggregate',
            text   : 'Total',
            flex   : 1,
            editor : false,
            // will be used for group header
            format : {
                locale      : 'en-US',
                template    : '$9,999',
                currency    : 'USD',
                significant : 5
            },
            function : 'sum', // or function if required, will be used for group header
            field           : 'total',
            sum             : (sum, record) => 'this will be shown in a footer'
        }

All the best,
Alex


Post Reply