mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add cell selection summary
Summary: Adds a cell selection summary to grid view that shows either a count or sum of all the selected values. Implementation was done by Dmitry. Test Plan: Browser tests. Reviewers: jarek Reviewed By: jarek Subscribers: paulfitz, dsagal, jarek Differential Revision: https://phab.getgrist.com/D3630
This commit is contained in:
@@ -169,18 +169,24 @@ export class TableData extends ActionDispatcher implements SkippableRows {
|
||||
return this._rowMap.has(rowId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the index of the given rowId, if it exists, in the same unstable order that's
|
||||
* returned by getRowIds() and getColValues().
|
||||
*/
|
||||
public getRowIdIndex(rowId: UIRowId): number|undefined {
|
||||
return this._rowMap.get(rowId as number);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a column name, returns a function that takes a rowId and returns the value for that
|
||||
* column of that row. The returned function is faster than getValue() calls.
|
||||
*/
|
||||
public getRowPropFunc(colId: string): UIRowFunc<CellValue|undefined> {
|
||||
const colData = this._columns.get(colId);
|
||||
if (!colData) { return () => undefined; }
|
||||
const values = colData.values;
|
||||
const rowMap = this._rowMap;
|
||||
return (rowId: UIRowId) => {
|
||||
const colData = this._columns.get(colId);
|
||||
if (!colData) { return undefined; }
|
||||
const values = colData.values;
|
||||
return values[rowMap.get(rowId as number)!];
|
||||
};
|
||||
return (rowId: UIRowId) => values[rowMap.get(rowId as number)!];
|
||||
}
|
||||
|
||||
// By default, no rows are skippable, all are kept.
|
||||
|
||||
Reference in New Issue
Block a user