// noinspection JSUnusedLocalSymbols Vue.component('warehouse-order', { //language=Vue template: ` `, data() { return { window: window, historyModal: false, historyModalId: null, observer: null, orderLazyLoad: {}, } }, mounted() { this.observer = new MutationObserver((mutations) => { const lazyLoadingElements = document.querySelectorAll('.lazy-loading'); console.log(lazyLoadingElements); // check row id and check if it is already defined in orderLazyLoad else alert('loading') // if it is defined do nothing for (const element of lazyLoadingElements) { if (element.dataset.rowId in this.orderLazyLoad) { continue; } this.loadOrder(element.dataset.rowId); } }) this.observer.observe(document.querySelector('.tt-table-container'), {childList: true, subtree: true,}); }, methods: { async loadOrder(rowId) { this.orderLazyLoad[rowId] = true; // use BASE_PATH . /WarehouseOrder/getOrderItems?id= + rowId const response = await axios.post(`${window.TT_CONFIG["BASE_PATH"]}/WarehouseOrder/getOrderItems?id=${rowId}`); console.log(response.data); this.orderLazyLoad[rowId] = response.data; // force re-render of the table this.$refs.table.$forceUpdate(); } }, beforeDestroy() { this.observer.disconnect(); } })