mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Adding onNewRecord event for custom widgets
Summary: New onNewRecord event in custom widgets that is triggered when the user selects a blank row. Together with this diff there is PR for grist-help https://github.com/gristlabs/grist-help/pull/150 Test Plan: added test case Reviewers: cyprien Reviewed By: cyprien Differential Revision: https://phab.getgrist.com/D3375
This commit is contained in:
@@ -73,7 +73,7 @@ export class CustomView extends Disposable {
|
||||
private _emptyWidgetPage: string;
|
||||
|
||||
public create(gristDoc: GristDoc, viewSectionModel: ViewSectionRec) {
|
||||
BaseView.call(this as any, gristDoc, viewSectionModel);
|
||||
BaseView.call(this as any, gristDoc, viewSectionModel, { 'addNewRow': true });
|
||||
|
||||
this._customDef = this.viewSection.customDef;
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@ export class GristViewImpl implements GristView {
|
||||
// Hidden/Visible columns will eventually reflect what is available, but this operation
|
||||
// is not instant - and widget can receive rows with fields that are not in the mapping.
|
||||
const columns: ColumnRec[] = this._visibleColumns();
|
||||
const rowIds: number[] = this._baseView.sortedRows.getKoArray().peek() as number[];
|
||||
const rowIds = this._baseView.sortedRows.getKoArray().peek().filter(id => id != 'new');
|
||||
const data: BulkColValues = {};
|
||||
for (const column of columns) {
|
||||
// Use the colId of the displayCol, which may be different in case of Reference columns.
|
||||
|
||||
Reference in New Issue
Block a user