Hello guys, I am considering Bryntum Grid for my next project.
Trying to implement a react tree grid with ability to move rows freely + synch backend, I am not convinced by my approach using onDataChange. Any help or implementation examples?
Thanks!
const syncData = ({ store, action, records, isExpand, isCollapse }) => {
//console.log(`${store.id} changed. The action was: ${action}. Changed records: `, records);
if (!isExpand && !isCollapse) {
switch (action) {
case 'update':
// device field update (except parent)
if (!records[0].meta.modified.hasOwnProperty('parentId')) {
const key = Object.keys(records[0].meta.modified);
const value = records[0].data[key];
transact([tx.devices[records[0].data.id].update({ [key]: value })]);
}
break;
case 'add':
// device parent update
if (records[0].meta.modified.hasOwnProperty('parentId')) {
transact([tx.devices[records[0].data.id].update({ parentId: records[0].data.parentId })]);
}
//TODO: manage copy-paste case for proper id generation
break;
}
}
}
Hey marcio, thank you for the prompt reply. I think I managed to solve it in the end, but had trouble navigating the doc. Here's my path, from react examples to store CRUD features