Datatable sum of column - big data database

Hi,

Exist possibility to show sum from a big database set for colum ?
Now I did datafetch about 200 items. In table is about 4K records.
As I understad - footer:{content:“summColumn”} - is calculating only fetched items ?

How to return sum of specified column to datatable ?
Data must be returned as json file - data[], pos, total_count. Of course I can add some owns data and in “onAfterLoad” event read it.

Can you point me with a small sample how to do that ?

Many thanks in advance!

Hello @Rimantas_Usevicius,

By default, you can set either static text in the footer, or one of the ready-made elements in content - these can be filters, and summColumn, which calculates and displays the sum of the column.

With the onParse method, you can access the uploaded data and extract any incoming parameters.

The incoming parameter can be displayed as static text using getColumnConfig() , and then replaced in the footer configuration with the text using the refreshColumns() method.

Please, check out the snippet with solution here

But, of course, you can write a custom element that will always take the specified value. This approach has an advantage: the element will be updated automatically along with data changes, and each time the data is reloaded (with server-side filtering, for example), the required value will be taken.

1 Like

Hi, Natasha,

Thanks for you and your sample. It’s more clear now … :slight_smile:

Have a nice day!

1 Like