New React lists feel great! I would love to learn more about Even Listeners for the new React lists to move our custom codes to the new version. Some of our use cases:
_ Listen for when the list finishes loading.
_ Listen for filter value change.
_ Count the number of total items
_ Mutation Observer / when a node is inserted
block-loaded event is triggered when React mounts the block into DOM. It can be used instead of DOMContentLoaded event that is used in old custom codes.
get-records event is triggered on every data response from softr data service. It can be used for getting the data manipulating before it get’s rendered.
const onRecords = (e) => {
// we got new data under e.details
console.log(e.detail);
//console.log [{id: '***', fields: {...}}]
};
window.addEventListener('get-records-table1', onRecords);
const onRecords = (e) => {
setTimeout(() => {
// The block finish rendering
// I may do some staff here.
}, 50);
};
window.addEventListener('get-records-table1', onRecords);
get-records:before event that is triggered before sending request, It can be used to catch the inline filter or search field changes.