(function esperarYReemplazarHeader() { let intentos = 0; const maxIntentos = 30; // ~15 segundos const intervalo = setInterval(() => { const ths = document.querySelectorAll('#example thead th'); if (ths.length > 0) { ths.forEach(th => { if (th.textContent.trim() === 'Peso bruto') { th.textContent = 'PMA'; console.log('✅ Header cambiado a PMA'); clearInterval(intervalo); // Detenemos una vez que lo logramos } }); } intentos++; if (intentos >= maxIntentos) { console.warn('⚠️ No se detectó el header "Peso bruto" a tiempo.'); clearInterval(intervalo); } }, 500); // Revisa cada 500ms })(); // ]]>
(function esperarYReemplazarHeader() { let intentos = 0; const maxIntentos = 30; // ~15 segundos const intervalo = setInterval(() => { const ths = document.querySelectorAll('#example thead th'); if (ths.length > 0) { ths.forEach(th => { if (th.textContent.trim() === 'Peso bruto') { th.textContent = 'PMA'; console.log('✅ Header cambiado a PMA'); clearInterval(intervalo); // Detenemos una vez que lo logramos } }); } intentos++; if (intentos >= maxIntentos) { console.warn('⚠️ No se detectó el header "Peso bruto" a tiempo.'); clearInterval(intervalo); } }, 500); // Revisa cada 500ms })(); // ]]>