Ver Mensaje Individual
  #6 (permalink)  
Antiguo 15/06/2012, 16:24
Avatar de khristian_696
khristian_696
 
Fecha de Ingreso: agosto-2008
Mensajes: 27
Antigüedad: 15 años, 9 meses
Puntos: 4
Respuesta: Script OnLoad no permite cambiar el estilo en tabla

Gracias nuevamente furoya, te comentaba que el código no está completo debido a que es demasiado extenso es por eso que no encuentras ciertas referencias, y a mi consideración esa es la escencia del programa.

No es mi intención que nadie trabaje por mí, aclaro, el desarrollo tiene el 99% de funcionalidad, sólo que al implementar esta bendita cabecera fija, creí conveniente esta solución debido a que arriba de mi tabla tengo un div con filtros los cuales siempre permanecen a la vista ya que la tabla se encuentra en un div que tiene scrollbars y eso es un plus.

Yendo más al grano, estuve debugueando el código y el problema está en la siguiente función que es la que hace el efecto de la cabecera fija, si yo comento la línea que marco con rojo, la tabla recupera su funcionalidad pero obviamente la cabecera deja de ser fija, de hecho estoy investigando a fondo
que realiza DivHR.appendChild(tbl.cloneNode(true)); (En específico "tbl.cloneNode(true)"), sé que se agrega la cabecera al div que fungirá como cabecera pero hasta ahí.

Código:
function MakeStaticHeader(gridId, height, width, headerHeight, isFooter) {
                var tbl = document.getElementById(gridId);
                if (tbl) {
                var DivHR = document.getElementById('DivHeaderRow');
                var DivMC = document.getElementById('DivMainContent');
                var DivFR = document.getElementById('DivFooterRow');

                //*** Set divheaderRow Properties ****
                DivHR.style.height = headerHeight + 'px';
                DivHR.style.width = (parseInt(width) - 16) + 'px';
                DivHR.style.position = 'relative';
                DivHR.style.top = '0px';
                DivHR.style.zIndex = '30';
                DivHR.style.verticalAlign = 'top';

                //*** Set divMainContent Properties ****
                DivMC.style.width = width + '.px';
                DivMC.style.height = height + '.px';
                DivMC.style.position = 'relative';
                DivMC.style.top = -headerHeight + '.px';
                DivMC.style.zIndex = '20';

                //*** Set divFooterRow Properties ****
                DivFR.style.width = (parseInt(width) - 16) + 'px';
                DivFR.style.position = 'relative';
                DivFR.style.top = -headerHeight + 'px';
                DivFR.style.verticalAlign = 'top';
                DivFR.style.paddingtop = '2px';

                if (isFooter) {
                 var tblfr = tbl.cloneNode(true);
                 tblfr.removeChild(tblfr.getElementsByTagName('tbody')[0]);
                 var tblBody = document.createElement('tbody');
                 tblfr.style.width = '100%';
                 tblfr.cellSpacing = "0";
                 //*****In the case of Footer Row *******
                 tblBody.appendChild(tbl.rows[tbl.rows.length - 1]);
                 tblfr.appendChild(tblBody);
                 DivFR.appendChild(tblfr);
                 }
                 
                //****Copy Header in divHeaderRow****
          DivHR.appendChild(tbl.cloneNode(true));
                           
             }
            }

Agradezco tu tiempo y apoyo.
Saludos