• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove header values using HTML Table Class

#1
[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>

#2
[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.

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

thanks

#4
[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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.