title: Hide table column when td rows are empty
body: <p>Table:</p>
  
  <pre><code>&lt;table cellspacing = "0" cellpadding = "0" border = "1" width = "90%" class="table1"&gt;
      &lt;tr &gt;                    
          &lt;th&gt;&lt;b&gt;Pos&lt;/b&gt;&lt;/th&gt;
          &lt;th&gt;&lt;b&gt;NICOMATIC P/N&lt;/b&gt;&lt;/th&gt;
          &lt;th&gt;&lt;b&gt;Client P/N&lt;/b&gt;&lt;/th&gt;
          &lt;th&gt;&lt;b&gt;ADD&lt;/b&gt;&lt;/th&gt;
          &lt;th&gt;&lt;b&gt;Quantity Ordered &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Requested Date &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  Discount  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unit Price&lt;/b&gt;&lt;/th&gt;
          &lt;!--&lt;td&gt;&lt;b&gt;Discount&lt;/b&gt;&lt;/td&gt;
          &lt;td&gt;&lt;b&gt; &amp;nbsp;&lt;/b&gt;&lt;/td&gt;                          
          &lt;td&gt;Add&lt;/td&gt; --&gt;  
      &lt;/tr&gt;
      &lt;apex:repeat value="{!qouteLineItemMap}" var="qliRow" id="theQliRepeat"&gt;
      &lt;apex:repeat value="{!qouteLineItemMap[qliRow]}" var="qli" id="therepeat1"&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;apex:outputText value="{!FLOOR(rowNum)}" style="align:center;"/&gt;&lt;/td&gt;
          &lt;td class = "tdCustom" &gt; &lt;apex:outputfield value="{!qli.Name}"/&gt;&lt;apex:inputfield value="{!qli.Or_Nicomatic_p_n__c}"/&gt;&lt;/td&gt;
          &lt;td class = "tdCustom" &gt;&lt;apex:outputField value="{!qli.Client_P_N__c}" /&gt;&lt;apex:inputfield value="{!qli.Or_clientpn__c}"/&gt;&lt;/td&gt;
          &lt;td class = "tdCustom" &gt;
          &lt;apex:commandButton value="Add" action="{!addBatch}" reRender="pb,errormsg" immediate="true"&gt;
          &lt;apex:param assignTo="{!qliRowNum}" value="{!rowNum}" name="qliRowNum"/&gt;
          &lt;/apex:commandButton&gt;
          &lt;/td&gt;
          &lt;td class = "tdCustom" style="width:100px;"&gt;             
          &lt;apex:repeat value="{!batchMap[qliRow]}" var="child" id="therepeat2"&gt;
          &lt;table class="table-data" border = "1"&gt;
          &lt;apex:variable value="{!1}" var="batchrowNum"/&gt;
              &lt;tr id="tr_clone"&gt;
                  &lt;td&gt;&lt;apex:inputfield value="{!child.Quantity_Ordered__c}"  style="width:70px" required="true"/&gt;&lt;/td&gt;
                  &lt;td&gt; &lt;apex:inputfield value="{!child.Requested_Date__c}"  style="width:90px" required="true"/&gt;&lt;/td&gt; 
                  &lt;td&gt; &lt;apex:inputfield value="{!child.Discount__c}" style="width:40px" required="true"/&gt;&lt;/td&gt;                       
                  &lt;td&gt;&lt;apex:inputfield value="{!child.Unit_Price__c}"  style="width:110px" required="true"/&gt;&lt;/td&gt;
                  &lt;td&gt;
                  &lt;apex:commandButton value="Delete" action="{!deleteBatch}" reRender="pb,errormsg" id="deleteBatchid" immediate="true"&gt;
                  &lt;apex:param assignTo="{!qliRowNum}" name="deleteQlihRow" value="{!rowNum}"/&gt;
                  &lt;apex:param assignTo="{!deleteBatchRow}" name="deleteBatchRow" value="{!batchrowNum}"/&gt;
                  &lt;/apex:commandButton&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;apex:variable var="batchrowNum" value="{!batchrowNum+ 1}"/&gt;
          &lt;/table&gt;
          &lt;/apex:repeat&gt;
          &lt;/td&gt; 
      &lt;/tr&gt;
      &lt;apex:variable var="rowNum" value="{!rowNum + 1}"/&gt; 
      &lt;/apex:repeat&gt;  
      &lt;/apex:repeat&gt;
  &lt;/table&gt;                                 
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>&lt;script&gt;
   $('.table1 tr th').each(function(i) {
          //select all tds in this column
          var tds = $(this).parents('table')
              .find('tr td:nth-child(' + (i + 1) + ')');
          if(tds.is(':empty')) {
              //hide header
              $(this).hide();
              //hide cells
              tds.hide();
          } 
      }); 
  
  &lt;/script&gt;          
  </code></pre>
  
  <p>intially </p>
  
  <pre><code>&lt;th&gt;&lt;b&gt;Quantity Ordered &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Requested Date &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  Discount  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unit Price&lt;/b&gt;&lt;/th&gt;
  </code></pre>
  
  <p>This column was empty .i want hide this when td was empty for entire column. I want to show the column when any one of the td is non empty .i had tried with the above code but it was not working.</p>
  
  <p>Thank you in advance.</p>