Welcome Guest, Not a member yet? Register   Sign In
add extra colums to a table
#1

[eluser]allaerd[/eluser]
Hello,

I use the html table lib alot. But when i generate a table i want to add colums to edit, delete that current row. I did not want to loop through the data array from my model. I just want to use:
Code:
$this->table->set_empty(" ");
$this->table->set_heading($fields);
echo $this->table->generate($data);

i figured out a nice way to add colums with jquery. Hope people can use it.
Code:
//mark all first children from tr
$("tr td:first-child").addClass('first');
//add extra colums at the header
$('thead tr th:last-child').after('<th></th>');    
//loop through all tr's
$('tbody tr').each(function(index) {
  //mark the first row as primary key and use that value as parameter
  var var_pk = $(this).children('.first');
  $(this).append('<td><a href="/directory/controler/function/'+$(var_pk).text()+'">Aanpassen</a></td>');
});

hope somebody can use it!




Theme © iAndrew 2016 - Forum software by © MyBB