Skip to main content

Apply model — seed-on-change

options is re-applied to the table only when its object reference changes. Re-rendering the host with the same options object preserves edits the user made inside the table. To push a new configuration, pass a new object.

const [options, setOptions] = useState(initialOptions);

<AuraPivot
dataSource={rows}
options={options}
onOptionsChange={setOptions}
/>;

Feeding onOptionsChange straight back into options is safe — the component recognises its own emitted object and does not re-apply it.

Reading edits back out

function handleChange(next) {
// `next` is the complete, updated options object.
saveToServer(next);
setOptions(next);
}

<AuraPivot dataSource={rows} options={options} onOptionsChange={handleChange} />;

See also