Adding Totals to VueTable/VDataTable
The Kitchen sink data-tables has been updated to include adding totals to data-table.
Step 1: Define your fields and titles
Step 2: Define your fields which will be summed. For each field indicate which callback should be used to sum contents of that field.
Note that in the first column we have "total", this "total" is not hard coded as any column can have a sum.
Step 3: Define the callbacks
Sub sumname As String
Return "Totals"
End Sub
Other columns
Sub sumfat As Double
Dim recs As List = dt1.GetData
Dim tot As Double = BANanoShared.ListSumProperty(recs, "fat")
Return tot
End Sub
This gets the data from the data-table (including any changes made). It sums up the "fat" field and returns the value.
Everything else is done internally by the VueTable.BuildSlots method.
Have fun.
PS: A bug for fixing the v-data-table header was also fixed. To have the header fixed, checked the fixed header property and then specify a height of the v-data-table.