- Need to display a table of filtered dm records
- There are +1000 records in the db so the table needs to be paged.
- The table is dynamically filtered by post/session data
So far my code looks like this:
Code:
... Controller
// load dm model
$this->load->model('contact');
// method adds relevant dm 'where' clauses to object
$this->filter();
// get count of filtered records
$count = $this->contact->count();
// get filtered records
$this->contact->get(20, $offset);
This code will not work because after count() is called the sql clauses set by filter() will be lost.
If I comment out $this->contact->count(); and use count($this->contact->all) instead the maximum count possible will be 20.
I'm looking for a elegant way to retrieve both a full count of filtered records and a paged subset of filtered records without having to call filter twice.