setCurrentIndex
Sets which row is considered the current record. If the current record has unsaved changes, the method saves it before switching.
An optional waitForSave argument controls whether the call waits for that save to complete. When waitForSave is true, setCurrentIndex returns a promise that resolves after the save finishes. When false or omitted, the method switches index immediately and returns a boolean.
Passing -1 starts editing a new row. The new row is inserted into the database when endEdit or save is called.
Usage
// jump to second row without waiting for save
dsMyDataObject.setCurrentIndex(1);
// jump to second row and wait for current record to save
await dsMyDataObject.setCurrentIndex(1, true);
// start editing a new row
dsMyDataObject.setCurrentIndex(-1);API
setCurrentIndex(index: number): boolean;
setCurrentIndex(index: number, waitForSave: true): Promise<boolean>;
setCurrentIndex(index: number, waitForSave: false): boolean;Last updated
Was this helpful?