List Customisation: Difference between revisions

From Sage CRM Knowledge Base
Created page with " Client-side function to clear out empty rows on a table (tested in 7.1 only) -Makes an assumption about the first Td being empty function clearEmpptyTableRows() { var trco..."
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:
-Makes an assumption about the first Td being empty
-Makes an assumption about the first Td being empty


function clearEmpptyTableRows()
  function clearEmpptyTableRows()
{
var trcol=document.getElementsByTagName("TR");
 
  for (var i=1;i<trcol.length;i++)
   {
   {
     //get the first td
     var trcol=document.getElementsByTagName("TR");
var _td=trcol[i].childNodes[0];
    for (var i=1;i<trcol.length;i++)
if (_td!=null)
    {
{
      //get the first td
      var _td=trcol[i].childNodes[0];
  if ((_td.innerHTML=="")||(_td.innerHTML==null)||(_td.innerHTML=="&nbsp;"))
      if (_td!=null){
  {
          if ((_td.innerHTML=="")||(_td.innerHTML==null)||(_td.innerHTML=="&nbsp;")){
if ((_td.className=='ROW2')||(_td.className=='ROW1'))
                if ((_td.className=='ROW2')||(_td.className=='ROW1')){
{
                  trcol[i].style.visibility='hidden';
  trcol[i].style.visibility='hidden';
                  trcol[i].style.display='none';
  trcol[i].style.display='none';
                }
}
          }else{
  }else{
              //console.log(i+"-"+_td.innerText);
    //console.log(i+"-"+_td.innerText);
              //console.log(i+"-"+_td.innerHTML);
//console.log(i+"-"+_td.innerHTML);
          }
  }
      }
}
    }
   }
   }
}

Latest revision as of 10:55, 25 June 2015

Client-side function to clear out empty rows on a table (tested in 7.1 only)

-Makes an assumption about the first Td being empty

 function clearEmpptyTableRows()
 {
   var trcol=document.getElementsByTagName("TR");
   for (var i=1;i<trcol.length;i++)
   {
     //get the first td
     var _td=trcol[i].childNodes[0];
     if (_td!=null){
          if ((_td.innerHTML=="")||(_td.innerHTML==null)||(_td.innerHTML==" ")){
               if ((_td.className=='ROW2')||(_td.className=='ROW1')){
                 trcol[i].style.visibility='hidden';
                 trcol[i].style.display='none';
               }
          }else{
              //console.log(i+"-"+_td.innerText);
              //console.log(i+"-"+_td.innerHTML);
          }
      }
   }
 }