CodeIgniter Forums
Remove header values using HTML Table Class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Remove header values using HTML Table Class (/thread-2456.html)



Remove header values using HTML Table Class - El Forum - 08-07-2007

[eluser]webdude[/eluser]
I am using the HTML Table Class to generate a table via data from my db. How do I remove the heading values that get carried across from my sql code.

Eg: the below sql would output the header col-1 and col-2

Code:
$this->load->library('table');

$query = $this->db->query("SELECT col-1, col-2 FROM my_table");

echo $this->table->generate($query);

The aim is to create a table in the following format:

Code:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th scope="row">&nbsp;</th>
    <td>&nbsp;</td>
  </tr>
</table>



Remove header values using HTML Table Class - El Forum - 08-07-2007

[eluser]sophistry[/eluser]
EDIT: fixed set_header() to say set_heading(). The manual page for the HTML Table class is a good place to start learning about the set_heading() method.


Remove header values using HTML Table Class - El Forum - 08-07-2007

[eluser]webdude[/eluser]
have already looked at that but it does not say anything about table headers.

thanks


Remove header values using HTML Table Class - El Forum - 08-07-2007

[eluser]sophistry[/eluser]
So, you want to be able to change what is in the th cell? set_heading() method will allow you to do that. send it your nbsp.

um... this is copied directly from the generate() method:
Code:
// Is there a table heading to display?
        if (count($this->heading) > 0)
        {
            $out .= $this->template['heading_row_start'];
            $out .= $this->newline;        

            foreach($this->heading as $heading)
            {
                $out .= $this->template['heading_cell_start'];
                $out .= $heading;
                $out .= $this->template['heading_cell_end'];
            }

            $out .= $this->template['heading_row_end'];
            $out .= $this->newline;                
        }
It says "if heading has been set then use the heading_cell_ template values to construct a heading row."

If this is not what you are asking, then your question needs to be restated with code.