EE: 2.1.3 build 20101220
In working on an Accessory view this weekend I noticed that I cannot use the HTML Table Library without injecting data into tables built on the CP pages. I tried using the ->clear() method in my view but it had no effect. Regardless of what I did, I was manipulating the tables in the CP.
Is there an alternate advised approach to using this library in Accessories or would this be considered a bug?
Thanks 😊
Not quite. I think it’s more accurate to say you cannot use the HTML Table Library on a CP page that also uses it. You can always build tables on your own. It also shouldn’t really matter on your own module or extension views because they’re most often called apart from CP pages with tables.
I’ve only encountered this while building views for Accessories. I imagine there may be other instances of this possibility but I have not looked for them.
Sure thing Wes. Here’s a filtered down version:
The accessory contains:
function set_sections()
{
$this->EE =& get_instance();
$this->EE->load->library('table');
$this->sections['Recent Deployment Notes'] = $this->EE->load->view('test', '', TRUE);
}The views/test.php file contents:
<?php
$this->table->clear();
$this->table->set_heading(
'heading 1',
'heading 2',
'heading 3',
'heading 4'
);
$this->table->add_row(
'col 1',
'col 2',
'col 3',
'col 4'
);
$this->table->add_row(
'col 1',
'col 2',
'col 3',
'col 4'
);
$this->table->add_row(
'col 1',
'col 2',
'col 3',
'col 4'
);
$this->table->generate();
?>The end result can be seen in the attached image.
If $this->table->generate() is being used in views, and not calling $this->table->clear(), this behavior will happen.
Just saw this statement. I wanted to verify what you meant. I did, in fact, call $this->table->clear() in my view file. That doesn’t affect the CI bug you found though I presume.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.