summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Petculescu <gxgpet@gmail.com>2016-10-01 09:10:04 +0200
committerGeorge Petculescu <gxgpet@gmail.com>2016-10-01 09:10:04 +0200
commit8800fedd37be6fe4267ed7635fc536ff91a94c62 (patch)
tree860a3e5af9ab33afc42d5ebfa8f7698bb3ff6087
parent30a66c8cb47ef785b08843b7051b2003ed907246 (diff)
- small fix for HTML Table library: caption is not clearing properly and method chaining has been fixed for set_caption method.
-rw-r--r--system/libraries/Table.php2
-rw-r--r--user_guide_src/source/libraries/table.rst4
2 files changed, 5 insertions, 1 deletions
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index 3bce294d8..37a639d1d 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -277,6 +277,7 @@ class CI_Table {
public function set_caption($caption)
{
$this->caption = $caption;
+ return $this;
}
// --------------------------------------------------------------------
@@ -426,6 +427,7 @@ class CI_Table {
$this->rows = array();
$this->heading = array();
$this->auto_heading = TRUE;
+ $this->caption = NULL;
return $this;
}
diff --git a/user_guide_src/source/libraries/table.rst b/user_guide_src/source/libraries/table.rst
index 91ae1ae8d..fb6fefadb 100644
--- a/user_guide_src/source/libraries/table.rst
+++ b/user_guide_src/source/libraries/table.rst
@@ -275,11 +275,12 @@ Class Reference
:returns: CI_Table instance (method chaining)
:rtype: CI_Table
- Lets you clear the table heading and row data. If you need to show multiple tables with different data you should to call this method
+ Lets you clear the table heading, row data, and the caption. If you need to show multiple tables with different data you should to call this method
after each table has been generated to clear the previous table information. Example::
$this->load->library('table');
+ $this->table->set_caption('Preferences');
$this->table->set_heading('Name', 'Color', 'Size');
$this->table->add_row('Fred', 'Blue', 'Small');
$this->table->add_row('Mary', 'Red', 'Large');
@@ -289,6 +290,7 @@ Class Reference
$this->table->clear();
+ $this->table->set_caption('Shipping');
$this->table->set_heading('Name', 'Day', 'Delivery');
$this->table->add_row('Fred', 'Wednesday', 'Express');
$this->table->add_row('Mary', 'Monday', 'Air');