Sencha grid에서 추가된 row와 변경된 row 구분하기

2025. 1. 27. 22:18Javascript/Sencha

phantom을 통해서 구분함

const grid = this.up('grid');
const store = grid.getStore();
const modifiedRecords = store.getModifiedRecords();

if (modifiedRecords.length > 0) {
    const newRows = [];
    const changedRows = [];

    // Separate new rows (phantoms) and changed rows
    modifiedRecords.forEach(record => {
        if (record.phantom) {
            newRows.push(record.getData());
        } else {
            changedRows.push(record.getData());
        }
    });
}