Record
A ModelRecord is a single row managed by a store. Records track which fields you have changed since the last commit and let you roll back unsaved edits.
Get a record
Stores expose several lookup methods:
store.getAt(0); // by index
store.find('id', 1); // by field value
store.findBy(r => r.get('age') > 20); // by predicate
store.getCount(); // total visible recordsRead fields
const record = store.getAt(0);
const name = record?.get('name');
const age = record?.get('age');get returns the field's current value, including any uncommitted edits.
Mutate a record
record?.set('age', 31);
console.log(record?.isDirty()); // true
record?.commit(); // clears dirty flag
// record?.reject() // reverts to last committed snapshotset updates the in-memory value and marks the field dirty. The change does not propagate to the proxy automatically — you must call commit() (or perform whatever save action your app uses) explicitly.
Dirty tracking
A record is dirty when at least one of its fields has been modified since the last commit(). The framework uses this state in two places:
- The
Tablecomponent tints dirty rows differently (token:table.row.dirty— see Theming). - A
Bindingcalls itsonChangelisteners whenever the dirty state changes.
record.isDirty(); // any field dirty?
record.isFieldDirty('name'); // this specific field?
record.commit(); // mark everything clean
record.reject(); // revert to clean snapshotNew vs existing records
store.add() creates new records. New records render with a different background tint in Table (token: table.row.new) until you commit them — useful for forms that batch insertions.
const [newRecord] = store.add({ id: 3, name: 'Carol' });
console.log(newRecord.isNew()); // true
// (after a successful save…)
newRecord.commit();
console.log(newRecord.isNew()); // false