ant-design-blazor
ant-design-blazor copied to clipboard
Table: Determine totals row (SummaryRow) using filter?
Dear Ant-Team,
Is it somehow possible to use only the filtered entries in the total in a table in which you use totals rows?
Currently I calculate the sum in a table by displaying the sum of the entire list displayed in the table using "SummaryRow" (e.g. list.Sum(...)). The problem occurs when the user sets filters, then of course my sum is no longer correct.
Thanks pc
Hello @true-perfect-code , you can use ITable.GetQueryModel() to get the filtered rows and calculate the sum.
void GetSum()
{
var queryModel = Table.GetQueryModel() as QueryModel<Data>;
var query = queryModel.ExecuteQuery(DB.Items);
var sum = query.Sum(x=> x.Num);
}
Thanks @ElderJames