Welcome Guest, Not a member yet? Register   Sign In
Creating Uniquie TR id's with the HTML table class
#1

[eluser]adamBouchard[/eluser]
Hello,

I'm trying to figure out how to add uniquie id's to TR's using the HTML table class.

In the following two functions, I am creating a table based on $data from a sql result. I want to be able to pass in the id for each row into the "TR" tag, so the user can click on the row to drill down.

Has any one ran into this situation yet?

Thanks,


here is my code:

public function get_results_table($data,$num,$template = 'filter')
{
//get the array keys and assign as the table headings
$th = array_keys($data[0]);

//set the caption
$this->ci->table->set_caption($num." ".$this->ci->application->action);

//set the headings
$this->ci->table->set_heading($th);

//set the template
$template_method = "_".$template."_template";
$tmpl = $this->$template_method();
$this->ci->table->set_template($tmpl);

//create non-breaking space if any value is empty
$this->ci->table->set_empty(" ");

//return the table
return $this->ci->table->generate($data);
}

private function _filter_template()
{
//TODO: HOW DO I PASS THE UNIQUE row ID into the TR????

$tmpl = array (
'table_open' => '<table>',
'row_start' => '<tr id="">',
'row_alt_start' => '<tr id="">',

);
return $tmpl;
}


Messages In This Thread
Creating Uniquie TR id's with the HTML table class - by El Forum - 11-16-2008, 01:43 PM
Creating Uniquie TR id's with the HTML table class - by El Forum - 11-16-2008, 10:06 PM
Creating Uniquie TR id's with the HTML table class - by El Forum - 11-17-2008, 06:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB